Java character transcoding and reversal codes

Source: Internet
Author: User

I recently in doing oaf two times development, in looking at other people write code, found that there are always similar statements: "\U65E0\U6548\U7684GP\U9879\U76EE\U7F16\U53F7", these statements are actually used Java_ The tools in Home are Native2ascii.exe transcoded. Oracle does not recommend this when displaying a message notification, and is usually a message that is assigned under the responsibility of the app developer. Let me show you how to use the Native2ascii.exe tool to transcode and reverse code.

1.java character transcoding

Open the dos window, enter cmd, and enter:cd C:\Program files\java\jdk1.7.0\bin into java_home directory for Java :

Create a new two files in Java_home:1.properties and 2.properties

Open 2.propertieswith Notepad, enter the text you want to encode, save it,

On the command line input:native2ascii-encoding gb2312 2.properties 1.properties, enter

Open the 1.properties file with Notepad and find the following transcoding content in the file:

\u535a\u5ba2\u56ed\uff0c\u7a0b\u5e8f\u5458\u7684\u4e0a\u7f51\u5bb6\u56ed\uff01

2.Java character Reversal code

Similarly, enter the contents of the code to be reversed in 1.properties, and save as:

\u672a\u8f93\u5165\u5408\u540c\u6027\u8d28

On the command line input:native2ascii-reverse 1.properties 2.properties, enter

The contents of the 2.properties were found to be: "not entered into a contractual nature",

Java character transcoding and reversal codes

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.