可用命令:
D:/Program Files/Java/jdk1.5.0/bin>native2ascii -encoding GBK E:/pageResource.properties E:/pageResource_zh_CN.properties
///
关于国际化转码的问题2008-06-26 14:36native2ascii -encoding gbk a.txt b.properties
native2ascii.exe 是 Java 的一个文件转码工具,是将特殊各异的内容 转为 用指定的编码标准文体形式统一的表现出来,它通常位于 JDK_home/bin 目录下,安装好 Java SE 后,可在命令行直接使用 native2ascii 命令进行转码,示例:
native2ascii -encoding 8859_1 c:/test.txt c:/temp.txt
将 test.txt 文件内容用 8859_1 转码,另存为 temp.txt 文件
格式:native2ascii -[options] [inputfile [outputfile]]
参数选项 options
-reverse:将 Latin-1 或 Unicode 编码转为本地编码
-encoding encoding_name:指定转换时使用的编码
inputfile:要转换的文件
outputfile:转换后的文件
互转(-encoding,非英文内容(如中文)转为编码符 或 编码符之间的转换),
逆转(-reverse,通常是将编码符转为非英文内容,或非英文内容之间的转换),
逆转时被转的文件编码和本地编码需一致,示例:
中文转为 ISO 8859_1 编码后,将 8859_1 码转为中文:
native2ascii -encoding 8859_1 c:/a.txt c:/b.txt,将 a 用 8859_1 转码,存为 b (8859_1 码)
native2ascii -encoding GBK c:/b.txt c:/c.txt,将 b 用 GBK 转码,存为 c (GBK 码)
native2ascii -reverse c:/c.txt c:/d.txt,将 GBK 编码 c 用本地编码转码,存为 d (中文内容)
中文转为 GBK 编码后,将 GBK 码转为中文:
native2ascii -encoding GBK c:/a.txt c:/b.txt,将 a 用 GBK 转码,存为 b (GBK 码)
native2ascii -reverse c:/b.txt c:/c.txt,将 GBK 编码 b 用本地编码转码,存为 c (中文内容)
例如struts国际化utf-8的转换方式:
native2ascii -encoding UTF-8 ApplicationResources_zh_src.properties ApplicationResources_zh.properties
通过 java jdk native2ascii 将文件中的GB2312编码内容装换为unicode 形式如下:
进入jdk 的bin目录执行命令:
native2ascii -encoding gb2312 ApplicationResources_before.properties ApplicationResources_zh.properties
其中ApplicationResources_before.properties需要转换的文件,ApplicationResources_zh.properties 转换后的unicode 编码文件,同样替换gb2312可以转换问其他的编码为unicode
-----------------------------------------------------------------------
在myeclipse的help菜单下
点击sowftware update 菜单,
再点find and install
选择seach for new feathures to install ,点击next
点击右边第一个也就是 new remote site那个按键, 随便乱输入一个名字。网址就输入下面这个
这是网址 http://propedit.sourceforge.jp/eclipse/updates/
到最后 去掉文件中3.1结尾的点完成就可以了。具体不多说。自已看的。自已清楚就行了
或:
window-->preferences-->content types-->java properties file
改为GBK或UTF-8 , 然后update, 确定.
如果再有问题, 则找到*.properties的资源文件,把编辑器改为PropertiesEditor.