Want to discard native2ascii tool and need approach to read Chinese characters directly_
We are working on giving support to Chinese language in our application ,and we are using properties files to store key value pairs for different locales but I read that we cant store Chinese characters directly as it is and can not read directly for that we have to use the native2ascii tool can be used to convert property files to and from other character encodings.(UTF-8 encoding in our case because properties file are read by default in ISO 8859-1 character encoding )
Check below link which says so,
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Properties.html#encoding So my question is, cant we set encoding(UTF-8) while reading properties file so that we can read Chinese character directly and there will not be need of native2ascii tool ?
Which version of Java are you using? If it's Java 6 (JDK 1.6), you can use the new load(Reader) method to read properties files in any encoding you like. Just wrap the stream in the appropriate InputStreamReader:
Reader propReader = new InputStreamReader(propStream, "UTF-8");