Java decodes the uniocde code in the xx. properties file to the traditional

Source: Internet
Author: User

Today, the boss asked me to convert the messages. properties under the project to simplified Chinese (English and Traditional Chinese ).

Ideas:

1. An Attribute file named messages_zh_CN.properties is created in the same directory.

2. Copy the property file content of the traditional messages_zh_TW.properties file.

Content:

CallSubflow = \ u8abf \ u7528 \ u5b50 \ u5716
CommandAction = Command \ u547d \ u4ee4
Condition = \ u689d \ u4ef6
Configuration = \ u914d \ u7f6e
Copy = \ u8907 \ u88fd
Cut = \ u526a \ u4e0b
DataDisplay = \ u986f \ u793a \ u6578 \ u64da \ u7bc0 \ u9ede
Defacondicondition = \ u9ed8 \ u8a8d \ u689d \ u4ef6
Delete = \ u522a \ u9664
Delimiter = \ u5206 \ u9694 \ u7b26 \ u89e3 \ u6790 \ u898f \ u5247
Delimitter_link = \ u5206 \ u9694 \ u7b26 \ u8b58 \ u5225 \ u898f \ u5247
DisableFinalState = \ u53d6 \ u6d88 \ u7d50 \ u675f \ u7bc0 \ u9ede
DisableStartState = \ u53d6 \ u6d88 \ u958b \ u59cb \ u7bc0 \ u9ede

Yes. key = value pair. What is this Nima !!

The following are the key points:

1. Replace the unicode code with Chinese characters (both traditional and simplified). Here we use the xx./jdk/bin/native2ascii.exe program.

How to use this program? You put xx./jdk/bin/path inPathThen, "Run"-"cmd" and directly use the 'native2ascii command '(see the command)

My % JAVA_HOME % PATH is my jdk root directory (You know this)

So I can directly use the native2ascii command

--------- Start to convert ------------

 

 

Note: First you need to locate the directory where the file you want to convert is located.-The encoding UTF-16 is defining the decoded format as UTF-16 (Man is two bytes so not UTF-8)

-Reverse indicates decoding.

Plugin_zh_tw.properties is the file to be decoded.

Plugin_zh_tw_aaaaaaa.properties is the converted file (automatically created, no manual creation required)

Refresh your directory and you will see the plugin_zh_tw_aaaaa.properties file. Double-click it to open it.

Callsubflow = callback subflow
Commandaction = command
Condition = Condition
Configuration = Configuration
Copy = strongswan
Cut = cut down
Datadisplay = metric point
Defacondicondition = silence Condition
Delete = Division
Delimiter = delimiter parsing rules
Delimitter_link = delimiter recognition rules
Disablefinalstate = Cancel end Vertex
Disablestartstate = Cancel the start Vertex

Look, it turns into a man !!

 

2. the following idea is simple: copy the content of the entire file, find a 'Online convertible 'website, enter the content paste, and convert it to a simplified one. I use w. a I E S. C n (not an advertisement. Remove spaces)

Callsubflow = call a subgraph
CommandAction = Command
Condition = condition
Configuration = configuration
Copy = copy cut = cut down
DataDisplay = show data nodes
DefaultCondition = default Condition
Delete = delete
Delimiter = delimiter parsing rules
Delimitter_link = delimiter recognition rules
DisableFinalState = Cancel the End Node
DisableStartState = Cancel the Start Node

 

In this case, paste them into the plugin_zh_TW_AAAAAAA.properties file (replace the previous traditional style)

 

3. convert them into unicode codes.

The native2ascii command is still used. The command is as follows:Native2ascii plugin_zh_TW_AAAAAAA.properties plugin_zh_CN.properties

 

Game over !!

The content is very simple and I hope to help you.

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.