why '?' appears as output while Printing unicode characters in java

后端 未结 5 1922
不思量自难忘°
不思量自难忘° 2020-12-21 08:47

While printing certain unicode characters in java we get output as \'?\'. Why is it so and is there any way to print these characters?

This is my code



        
5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-21 08:54

    I wrote an Open Source Library that has a utility that converts any String to Unicode sequence and vise-versa. It helps to diagnose such issues. So for instance to print your String you can use something like this:

    String str= StringUnicodeEncoderDecoder.decodeUnicodeSequenceToString("\\u0197" +
       StringUnicodeEncoderDecoder.encodeStringToUnicodeSequence("Test"));
    

    You can read about the library and where to download it and how to use it at Open Source Java library with stack trace filtering, Silent String parsing Unicode converter and Version comparison See the paragraph "String Unicode converter"

提交回复
热议问题