You can specify Unicode character with following escape sequence
\u XXXX
where XXXX refer to 4 hexadecimal digits representing value of the UTF-16 code unit.
E.g. a properties file might have the following entries:
s1=hello there
\u XXXX
where XXXX refer to 4 hexadecimal digits representing value of the UTF-16 code unit.
E.g. a properties file might have the following entries:
s1=hello there
s2=\u3053\u3093\u306b\u3061\u306f
In order to convert a file saved in non-ASCII encoding to ASCII, you can use native2ascii tool, found in <jdk>\bin
In order to convert a file saved in non-ASCII encoding to ASCII, you can use native2ascii tool, found in <jdk>\bin
non-ASCII |
native2ascii [options] [inputfile [outputfile]]
Description
The Java compiler and other Java tools can only process files which contain Latin-1 and/or Unicode-encoded (\udddd notation) characters. native2ascii converts files which contain other character encodings into files containing Latin-1 and/or Unicode-encoded charaters.
If outputfile is omitted, standard output is used for output. If, in addition, inputfile is omitted, standard input is used for input.
The Java compiler and other Java tools can only process files which contain Latin-1 and/or Unicode-encoded (\udddd notation) characters. native2ascii converts files which contain other character encodings into files containing Latin-1 and/or Unicode-encoded charaters.
If outputfile is omitted, standard output is used for output. If, in addition, inputfile is omitted, standard input is used for input.
Options :
-reverse
Perform the reverse operation: convert a file with Latin-1 and/or Unicode encoded characters to one with native-encoded characters.
-encoding encoding_name
Specify the encoding name which is used by the conversion procedure. The default encoding is taken from System property file.encoding. The encoding_name string must be taken from the first column of the table of supported encodings in the Supported Encodings document.
-Joption
Pass option to the Java virtual machine, where option is one of the options described on the reference page for the java application launcher. For example, -J-Xms48m sets the startup memory to 48 megabytes.
Source : Here
Source : Here
0 nhận xét:
Đăng nhận xét