This article describes how to convert JavaScript code into Chinese characters and Chinese characters into ASC, for more information about how to use JavaScript to convert Chinese characters and Chinese characters to ASC, see the following example. We will share this with you for your reference. The details are as follows:
We often use the Properties file when writing Java programs, and put some messages and other information in the Properties file, but we see some encoding.
The source file in the Struts1.1b2 example is Unicode encoded, so if you want to run the same as it, you must also encode your ApplicationResources_zh. There are two methods:
① Use jdk's native2ascii Tool.
Native2ascii function description:
Convert a file that contains both local and non-Unicode characters to a Unicode character.
Syntax: Native2ascii [options] [inputfile [outputfile]
Additional instructions: The Java compiler and other Java tools can only process files containing Latin-1 and/or Unicode (udddd mark) characters. Native2ascii converts a file containing other character encoding into a file containing Latin-1 and/or Unicode encoding characters.
If outputfile is omitted, the standard output device is used.
In addition, if inputfile is also omitted, standard input is used for device input.
Command Options:
-Reverse: convert a file containing Latin-1 and/or Unicode characters to a file containing local encoding characters.
-Encoding [encoding_name] specifies the encoding name used in the conversion process. The default encoding is obtained from the system property file. encoding.
Application Example: native2ascii-encoding GBK ApplicationResources. properties ApplicationResources_zh_CN.properties
My practices:
1. Copy ApplicationResource. properties with English information and rename it as a (to reduce the doscommand length );
2. Use Editplus to edit file a and write Chinese information. 3. In the Dos window, switch to the directory where File a is located and run: native2ascii a ApplicationResource_zh.properties.
② I used Javascript to write a tool for encoding and conversion of Chinese characters.. For reference only.
ASC success → NATIVE zookeeper @ Hangzhou zookeeper