UTF-8 Encoding ; Only some Japanese characters are not getting converted
character-encoding, encoding, java, utf, utf-8
Solution
Try with JVM parameter file.encoding to set with value UTF-8 in startup of Tomcat(JVM). E.x.: -Dfile.encoding=UTF-8
Problem
I am getting the parameter value as parameter from the Jersey Web Service, which is in Japaneses characters. Here, 'japaneseString' is the web service parameter containing the characters in japanese language. ``` String name = new String(japaneseString.getBytes(), "UTF-8"); ``` However, I am able to convert a few sting literals successfully, while some of them are creating problems. The following were successfully converted: ``` 1) アップル 2) 赤 3) 世丕且且世两上与丑万丣丕且丗丕 4) 世世丗丈 ``` While these din't: ``` 1) ひほわれよう 2) 存在する ``` When I further investigated, i found that these 2 strings are getting converted in to some JUNK characters. ``` 1) Input: ひほわれよう Output : �?��?��?れよ�?� 2) Input: 存在する Output: 存在�?�る ``` Any idea why some of the japanese characters are not converted properly? Thanks.