现象:
window 系统,cmd 命令中执行 curl 。
返回:
{“timestamp”:“2019-10-16T11:06:29.105+0000”,“status”:400,“error”:“Bad Request”,“message”:“JSON parse error: Invalid UTF-8 start byte 0xb2; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Invalid UTF-8 start byte 0xb2\n at [Source: (PushbackInputStream); line: 1, column: 39] (through reference chain: cn.xx.xxDTO[“msg”])”,“path”:"/url"}
本地启动服务,通过 postman、 swagger-ui 等调用发送正常。
因此,想知道 window 系统,cmd 中执行 curl 是否能指定编码。
结论:
目前得到了靠谱的结论:
命令行本身需要在UTF-8环境中编辑。大部分系统环境默认中文以UTF-8编码,除了Windows