如何将单引号转义为双引号转换为单引号 [英] How to escape single quotes into double quotes into single quotes

查看:678
本文介绍了如何将单引号转义为双引号转换为单引号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是符合此说明的命令行示例:

Here is an example of command line that fit this description :


curl http://dumbdomain.com/solr/collection2/update/json -H
'Content-type:application / json' d'{add:{doc:{uid:
79729,text:我有您的号码}}}'

curl http://dumbdomain.com/solr/collection2/update/json -H 'Content-type:application/json' -d ' { "add": { "doc": { "uid": "79729", "text" : "I''ve got your number"} } }'

我已经尝试了\'(不转义),url编码(不在这个另一端的urldecoded!)和''(引用消失!),没有成功。 / p>

I already tried \' (not escaped), url encoded (not urldecoded at this other end!) and '' (quote disappear!), without success.

推荐答案

如果您替换为'by unicode encoded'(这是\\\'),那么它的工作原理:

If you replace ' by unicode encoded ' (which is \u0027), then it works:

curl http://dumbdomain.com/solr/collection2/update/json -H 'Content-type:application/json' -d ' { "add": { "doc": { "uid": "79729", "text" : "I\u0027ve got your number"} } }'

奇怪,但值得了解!

这篇关于如何将单引号转义为双引号转换为单引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆