Closed fitz-97 closed 1 year ago
in request body , Not in response
How can I modify the character set of a request before the PluginFilter.filter() ?
like this
{"name":"??????","nonce":"4317740522","timestamp":"1670570280","sign":"ff8eaa5caff13c78863c99d5b6b6264d"}
same as #154
same as #154
This method doesn't seem to solve the problem. You can try it
This method doesn't seem to solve the problem. You can try it
It mainly depends on what encoding (maybe GBK?) your client is using for Chinese characters, and then use the same encoding to decode Chinese characters in java runner.
This method doesn't seem to solve the problem. You can try it
It mainly depends on what encoding (maybe GBK?) your client is using for Chinese characters, and then use the same encoding to decode Chinese characters in java runner.
The client and code uses the same character set.
However, I found the reason because my docker did not set the character set.
when java plugin start System.getProperty("file.encoding")
to be ANSI X3.4-1968
.
The startup parameter plus -Dfile.encoding=utf-8
solves the problem.
System.getProperty("file.encoding")
will be utf-8
.
apisix-java-plugin-runner version:0.4.0 apsix version:3.0.0
Test post request contain chinese characters in OKHttp:
{ "name":"测试" }
Custom filter in apisix-java-plugin-runner, get request body:{ "name":"æµu008Bè¯u0095" }