如何在Curl POST请求中传递特殊字符(åöä)?

时间:2018-09-06 11:29:07

标签: curl post special-characters urlencode

在发送带有特殊字符的Curl命令(通过Windows)时,我的影响力和愚蠢性很高。关于-F“ name = Anstalld”

这很完美: C:\ Services \ CURL \ curl.exe -X POST -H“授权:承载61b27a0ba58125d7ae36a77358973cb” -i -F“ companyId = 112” -F“ name = Anstalld ” -F“ privilegeIds [] = 211“ -F” privilegeIds [] = 1168“ -F” description = Role“ https://uri/roles? 但是,问题是我需要能够在参数内部使用诸如åöä之类的特殊字符,并且无法弄清楚该怎么做。

这不起作用: C:\ Services \ CURL \ curl.exe -X POST -H“授权:承载61b27a0ba58125d7ae36a77358973cb” -i -F“ companyId = 112” -F“ name = Anställd” -F“ privilegeIds [] = 211“ -F” privilegeIds [] = 1168“ -F” description = Role“ https://uri/roles? 如何跳过这些字符?非常感谢!

卷曲版本7.61.1(x86_64-pc-win32)libcurl / 7.61.1 OpenSSL / 1.1.0i(WinSSL)zlib / 1.2.11 brotli / 1.0.5 WinIDN libssh2 / 1.8.0 nghttp2 / 1.33.0 发布日期:2018-09-05

1 个答案:

答案 0 :(得分:0)

解决方案:编码特殊字符并将其作为数据ascii发送。 C:\ Services \ CURL \ curl.exe uri -X POST -H“内容类型:application / x-www-form-urlencoded; charset = UTF-8” -H“授权:Bearer ***” -i- -data-ascii“ companyId = xx&description = xx&privilegeIds [] = xx&name = Employee%20%C3%A5%20%C3%B6%20%C3%A4%20%C3%85%20%C3%96%20%C3 %84“ –