Monday, May 23, 2011

How to type UTF-8 strings in a Java class in Eclipse ?

Recently I was involved in a project where I had to type in Sanskrit words directly onto the Java class file to test my application.

Transliteration of the words typed in english to Sanskrit is beautifully taken care by Google IME , do check it, out its very good, no I would not do justice if I dont call it AWESOME!!
The following is a Screen shot shows how IME finds out that I want श्रीनिवास when I type in shrinivasa !If thats not cool what is??

I think I have endorsed google enough.Now, onto the topic at hand.Suppose we want to change the text file encoding of,to UTF-8.
  1. Navigate to the package-explorer tab and right click on .
  2. Click on Properties and in the first page will see the "Text File Encoding" section where Other radio is unselected.
  3. Now select the Other radio button and from the drop down and select "UTF-8" .
  4. Now click on OK and close window. From now u will be able to type and see un-garbled UTF-8 encoded strings on to the file
Thats all folks!! Thanks for reading...Will post more good stuff as I go along.

No comments:

Post a Comment