Tuesday, August 23, 2011

native2ascii vs ascii2native

In Java, to display Chinese character, we need to convert Chinese word to Unicode format.
e.g. 你好 becomes \u4F60\u597D.

We can use the following command to do conversion:
(Source: http://javaphoon.iteye.com/blog/148403)
native2ascii -encoding gb2312 test_native.properties > test_ascii.properties
native2ascii -reverse -encoding gb2312 test_ascii.properties > test_native2.properties

This is the online conversion tool: