Post json chinese encoding problem

  node.js, question

To help friends get a program, it is post in an easy language environment. I will pass a string of JSON with Chinese to node server. The string is as follows

{"itemdata": {"ntype": "1", "NBA oyou": "0", "szitemid": "536347062406", "title": "autumn and winter new women's clothing Korean version of semi-high collar fur women's padded slim fit slim long sleeve pullover sweater base shirt", "second title": ","imgurl ":" _!  !  0-item_pic.jpg","promotionTxt ":"limited time seconds kill price ","foldprice ":"108 ","fthirdprice ":"0 ","fcommissionper ":"10.5 ","fcommission ":"2.08 ","ntgcount ":"0 ",  "nsellcount": "37", "fpingfen": "0", "npingjiacount": "5", "sztgul": ","szwebtgurl ":","szblogtgurl": ","shorturl ":","szdesc": ","nick ":"allenstemar flagship store ","coupon ":"}}

Then, the server receives the garbled code that will be displayed later.

The postman test shows that only raw json can be sent and received correctly.
So I went online to find out what raw is, and found out whether it is to directly transmit data without any data coding transmission.
Finally, I thought, is it the text coding problem in the language environment?
Because postman is written by js, Postman has no differences in language environment coding.
That’s why it’s delivered normally? If this is the case, it should be possible to make the coding of the sending environment the same as js when sending in theory.
So I would like to ask, how can we solve the coding problem just by processing jsON correctly at the sending end like JS?
Because ..If transcoded to utf8, the server or want toDecode it againAs a technology, I don’t want to give up the best plan. So how can Great God solve it?


I also have this problem, I don’t know if the landlord has solved it, the filter has been added, the configuration of the server has been written, or the code has been scrambled.


After a whole morning of adjustment, I found out what my problem was.

bodyReader = new BufferedReader(new InputStreamReader(request.getInputStream()));
 body = bodyReader.readLine();

In the code, the requested content is converted into a string by the above method

No character set is specified, and the default character set is used as seen from the source code. the sun.nio.cs.StreamDecoder class uses the following methods

public static StreamDecoder forInputStreamReader(InputStream var0, Object var1, String var2) throws UnsupportedEncodingException {
 String var3 = var2;
 if(var2 == null) {
 var3 = Charset.defaultCharset().name();
 try {
 if(Charset.isSupported(var3)) {
 return new StreamDecoder(var0, var1, Charset.forName(var3));
 } catch (IllegalCharsetNameException var5) {
 throw new UnsupportedEncodingException(var3);

Then the default character set for my local environment is GBK, and decoding results in garbled code
By setting JVM parameters, -Dfile.encoding=UTF-8
Force to adjust the default character set to UTF-8, and then successfully solved my problem