本文介绍了转义引号和花括号时遇到麻烦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在命令提示符下执行以下行:
I am trying to execute the following line in Command Prompt:
curl -X POST -d '{ "method" : "account_info", "params" : [ { "account" : "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"} ] }' http://s1.ripple.com:51234
但是,我得到以下信息:
However, I get the following:
curl: (6) Could not resolve host: method
curl: (7) Failed connect to :80; No error
curl: (6) Could not resolve host: account_info,
curl: (6) Could not resolve host: params
curl: (7) Failed connect to :80; No error
curl: (3) [globbing] illegal character in range specification at pos 2
curl: (3) [globbing] unmatched brace at pos 2
curl: (6) Could not resolve host: account
curl: (7) Failed connect to :80; No error
curl: (3) [globbing] unmatched close brace/bracket at pos 35
curl: (3) [globbing] unmatched close brace/bracket at pos 1
curl: (3) [globbing] unmatched close brace/bracket at pos 1
unable to parse request
我在Windows上,错误与引号,花括号和glob有关.我尝试通过在反引号前加反斜杠来使引号转义,但是没有运气.
I am on Windows, and the error has to do with quotes, braces, and globbing. I tried escaping quotes by preceding them with a backslash, with no luck.
推荐答案
请勿使用单引号.用 \
转义字符串中的所有双引号.
Do not use single quotes. Escape any double quotes within the string with a \
.
curl -X POST -d "{ \"method\" : \"account_info\", \"params\" : [ { \"account\" : \"rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh\"} ] }" http://s1.ripple.com:51234
Window的 command.exe
似乎不支持单引号.PowerShell确实有,但是使用它们时仍然存在一些问题,因此最好的解决方案是根本不使用它们.
Window's command.exe
doesn't seem to support single quotes. PowerShell does, but there are still some problems when using them, so the best solution is to not use them at all.
这篇关于转义引号和花括号时遇到麻烦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!