JavaScript to convert Chinese characters and Chinese characters to ASC _ javascript skills

Source: Internet
Author: User
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  
   
    
     
      
     
    
   
  
 
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.