现在的位置: 首页 > 综合 > 正文

如何处理日文系统中的NEC拡張字

2018年02月01日 ⁄ 综合 ⁄ 共 891字 ⁄ 字号 评论关闭

使用原因:本系统原来定义的CHARSET=Shift_JIS

但是定义为shift_jis时,NEC拡張字,比如

② ③ ④ ⑤ ⑥ ⑦ ⑧ ⑨ ⑩ ⑪ ⑫ ⑬ ⑭ ⑮

⑰ ⑱ ⑲ ⑳ Ⅰ Ⅱ Ⅲ Ⅳ Ⅴ Ⅵ Ⅶ Ⅷ Ⅸ Ⅹ

㍉ ㌔ ㌢ ㍍ ㌘ ㌧ ㌃ ㌶ ㍑ ㍗ ㌍ ㌦㌣ ㌫ ㍊ ㌻

㎜ ㎝ ㎞ ㎎ ㎏㏄ ㎡ ㍻

〝 〟 ㊤ ㊥ ㊦ ㊧ ㊨ ㈱ ㈲ ㈹ ㍾ ㍽ ㍼

≡ ∫ ∮ ∑ √ ⊥ ∠ ∟ ⊿ ∵ ∩ ∪

不能正确的表示出来

例如,MS932 有字符(“@”等)将变为“?”

解决方法:--- 对于 JSP,在 page 标记中将 Shift_JIS 重写为 Windows-31J。

示例:

当 JSP 中存在以下行且使用 MS932 字符时,请将

<%@ page contentType="text/html; CHARSET=Shift_JIS" %>

重写为:

<%@ page contentType="text/html; CHARSET=Windows-31J" %>

 

在 Servlet 中更改 setContentType() 的规范。

对于 Servlet,当存在以下规范且使用 MS932 字符时,请将

response.setContentType("text/html;charset=Shift_JIS");

重写为:

response.setContentType("text/html;charset=Windows-31J");

 

Mysql数据库中使用MS932字符时,请将:

default-character-set= sjis

重写为:

default-character-set= cp932

 

相关知识:

“Windows-31J”是在 IANA 中正式注册的字符集名称,等同于 Microsoft 代码页 932(cp932)。

在 Java 中,MS932 等同于 Microsoft cp932。

因此,Java 中的“MS932”便是 IANA 的“Windows-31J”。

实际上在 Java 中,“Windows-31J”也是 MS932 的名。

 

附表:

下表列出了有效的字符集标签值以及等同的 IANA 标签明:

字符集标签

IANA 标签

cp932

windows-31j

Microsoft CP932 = Win31J-DBCS

sjis

shift_jis

Shift JIS(无

 

抱歉!评论已关闭.