Open lbrant opened 2 years ago
apisix-java-plugin-runner also use UTF_8
, see: https://github.com/apache/apisix-java-plugin-runner/pull/53/files
@tzssangglass
I mean body in request, fixed by modifing ExtraInfoResponse.getResult:
from:
public String getResult() {
StringBuilder builder = new StringBuilder();
for (int i = 0; i < this.resp.resultLength(); i++) {
builder.append((char) this.resp.result(i));
}
return builder.toString();
}
to
public String getResult() {
byte[] bytes = new byte[this.resp.resultLength()];
for (int i = 0; i < this.resp.resultLength(); i++) {
bytes[i] = (byte) this.resp.result(i);
}
return new String(bytes, StandardCharsets.UTF_8);
}
would you like to submit a PR to fix it?
@tzssangglass
I mean body in request, fixed by modifing ExtraInfoResponse.getResult:
from:
public String getResult() { StringBuilder builder = new StringBuilder(); for (int i = 0; i < this.resp.resultLength(); i++) { builder.append((char) this.resp.result(i)); } return builder.toString(); }
to
public String getResult() { byte[] bytes = new byte[this.resp.resultLength()]; for (int i = 0; i < this.resp.resultLength(); i++) { bytes[i] = (byte) this.resp.result(i); } return new String(bytes, StandardCharsets.UTF_8); }
确实有个问题
0.4.0 Cannot be modified manually
We can make it configurable by reading configuration from the configuration file.
Issue description
Environment
apisix-java-plugin-runner version:0.2.0 apsix version:2.13.1
Minimal test code / Steps to reproduce the issue
{"source":"高德地图","content":"https://surl.amap.com/1PoSAsa1l4Ud","deviceId":"123456"}
Charset charset = Util.UTF_8; byte[] bytes = content.getBytes(charset);
{"source":"é«å¾·å°å¾","content":"https://surl.amap.com/1PoSAsa1l4Ud","deviceId":"123456"}