UTF-8编码;只有一些日语字符没有得到转换 [英] UTF-8 Encoding ; Only some Japanese characters are not getting converted

查看:1198
本文介绍了UTF-8编码;只有一些日语字符没有得到转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从 Jersey Web Service (日本字符)中获取参数值作为参数。



'japaneseString'是包含日语字符的Web服务参数。

  String name = new String .getBytes(),UTF-8);但是,我能够成功转换一些sting字面量,而其中一些创建问题。 



以下已成功转换:

  1)アップル
2)赤
3)世丕且且世两上与丑万丣丕且丗丕
4)世世丗丈

这些din't:

  1)ひほわれよう
2)存在する



当我进一步调查时,我发现这两个字符串转换成一些JUNK字符。

  1)输入:ひほわよう输出: ?よ  
2)输入:存在する输出:存在 ? る

解决方案

div>

尝试使用JVM参数file.encoding在启动Tomcat(JVM)时使用值UTF-8进行设置。
E.x .: -Dfile.encoding = UTF-8


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.

解决方案

Try with JVM parameter file.encoding to set with value UTF-8 in startup of Tomcat(JVM). E.x.: -Dfile.encoding=UTF-8

这篇关于UTF-8编码;只有一些日语字符没有得到转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆