简体   繁体   中英

Why java String creates non-english characters like 'square'

When I try to assign my json result to a string value, it is not display non-english chars like: 这里

And here is my code;

            InputStream is  = connection.getInputStream();
            StringWriter sw = new StringWriter();
            IOUtils.copy(is, sw,"UTF-8");
            String s=sw.toString();
            JSONObject mainjobj= new JSONObject(s);

Is there anything wrong with my code ?

The problem isn't Java, the font used by Eclipse doesn't have the glyphs to display those characters, and therefor defaults to a square. You should check the font configuration of Eclipse, maybe you can select a different font that has full unicode support.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM