SpringSecurity3 读取中文消息资源(properties)文件,输出乱码的问题
2012-07-03 00:13
387 查看
因为Java识别编码为Unicode,而计算机系统编码常常是GBK,UTF8等编码,所以要转换为Unicode编码
这时可以用Java\jdk1.x.x\bin\native2ascii.exe工具。 用JDK提供的native2ascii,进行编码转换
用法:native2ascii [-reverse] [-encoding 源文件的编码] [文件 [输出文件]]
例如,把messages_zh_CN1.properties转换成messages_zh_CN2.properties。
先把要转换的文件messages_zh_CN1.properties放到Java\jdk1.x.x\bin\目录下,然后cmd进入bin的当前目录下输入
native2ascii -encoding
UTF-8 messages_zh_CN1.properties
messages_zh_CN2.properties
回车OKay!
#ascii =>Unicode
native2ascii messages_input.properties messages_zh_CN.properties
#UTF-8=>Unicode
native2ascii -encoding UTF-8 messages_input.properties messages_zh_CN.properties
#GBK=>Unicode
native2ascii -encoding GBK messages_input.properties messages_zh_CN.properties
注意源文件保存时的编码格式,否则转换后,输出时一样有乱码!
这时可以用Java\jdk1.x.x\bin\native2ascii.exe工具。 用JDK提供的native2ascii,进行编码转换
用法:native2ascii [-reverse] [-encoding 源文件的编码] [文件 [输出文件]]
例如,把messages_zh_CN1.properties转换成messages_zh_CN2.properties。
先把要转换的文件messages_zh_CN1.properties放到Java\jdk1.x.x\bin\目录下,然后cmd进入bin的当前目录下输入
native2ascii -encoding
UTF-8 messages_zh_CN1.properties
messages_zh_CN2.properties
回车OKay!
#ascii =>Unicode
native2ascii messages_input.properties messages_zh_CN.properties
#UTF-8=>Unicode
native2ascii -encoding UTF-8 messages_input.properties messages_zh_CN.properties
#GBK=>Unicode
native2ascii -encoding GBK messages_input.properties messages_zh_CN.properties
注意源文件保存时的编码格式,否则转换后,输出时一样有乱码!
相关文章推荐
- Properties文件中文属性读取是乱码问题
- 解决Java读取properties文件中文乱码的问题
- 读取Properties文件以及中文乱码问题
- spring使用@Value标签读取.properties文件的中文乱码问题的解决
- Java读取properties文件中文乱码问题的解决
- spring使用@Value注解读取.properties文件时出现中文乱码问题的解决
- Java读取properties文件中文乱码问题解决
- Java读取properties文件中文乱码问题解决
- Java读取properties文件中文乱码问题解决
- 解决Java读取properties文件中文乱码的问题
- java获得*.properties配置文件的值,解决读取中文时乱码的问题:
- Java读取properties文件中文乱码问题解决
- spring使用@Value标签读取*.properties文件的中文乱码问题的解决
- Java读取properties文件中文乱码问题解决
- java读取.properties文件及解决中文乱码问题
- spring使用@Value标签读取.properties文件的中文乱码问题的解决
- 解决读取JSON文件中文乱码的问题
- 关于Spring boot中读取属性配置文件出现中文乱码的问题的解决
- java菜鸟之properties文件不能写入中文或者写入中文乱码问题
- Properties文件中文乱码问题