Twitter Updates

Wednesday, August 02, 2006

[Java Tips] How to convert between different Unicode and Chinese character sets with only 3 clicks!!!

I was given a task to add simplified Chinese support for an existing application yesterday. I talked to myself: "It isn't that bad, I just need to create another ResourceBundle file in Simplified Chinese". Than I notice that the current Traditional Chinese ResourceBundle file contain HTML Unicode data, not Java Unicode. That means I cannot use the JDK's native2ascii tool to convert it back. Does it mean that I have to type all those texts in simplified Chinese all over again?? I talked to myself:" This is insane! I am not going to sit here all day and re-type the whole thing in HTML Unicode simplified Chinese!".

I decided to find ways to make my life easier. And this is the steps that I took to do it.

Before the start of the process, install Alibabar to your IE. I have this installed long ago already. It will add the following toolbar to your IE.



1) Goto this Unicode converter page. (Works in IE only)
2) Select HTML Unicode on the top menu, you could also use java Unicode, depending on your needs.
3) Copy and past the traditional Chinese resource bundle data to the lower left text box, than click the "Decimal Code to Characters" button under it.
4) You will see the original data on the top textbox. For me, I saw the original Traditional Chinese Characters.
5) Remember Alibabar? Now click the "Simplified Chinese" button in the Alibabar toolbar. This will convert exiting traditional Chinese data to simplified Chinese. Just like magic!!!
6) Click the "Characters to Dex, Hex Codes" button. Viola! You will see the converted text in the lower text box again! It is now in HTML Unicode formatted Simplified Chinese! No need to retype all of these!

Hope this tips help you in dealing with language convert for Java or other applications.

No comments: