Unicode Tutorials - Herong's Tutorial Notes
Dr. Herong Yang, Version 5.00

Encoding Conversion Programs for Encoded Text Files

This chapter provides tutorial notes and example codes on character encoding conversion. Topics include entering Unicode characters with \uxxxx escape sequences; viewing encoded text files in Hex values; converting text files from one encoding to another; viewing encoded text files in Web browsers; viewing Unicode signs/symbols in different encodings.

\uxxxx - Entering Unicode Data in Java Programs

HexWriter.java - Converting Encoded Byte Sequences to Hex Values

EncodingConverter.java - Encoding Conversion Sample Program

Viewing Encoded Text Files in Web Browsers

Unicode Signs in Different Encodings

Conclusion:

  • Java program seems to be a good way of storing Unicode characters into a file, if you don't have any good text editor that handles Unicode characters.
  • When converting text file from one encoding to another, you need to make sure that all characters in the text file are valid characters in the character set of the output encoding.
  • IE is a very good tool to view Unicode text, if you installed all the required fonts.

Exercise: Adding more messages in other languages in UnicodeHello.java.

Notes and sample codes bellow are based on JDK/J2SDK 1.4.1_01.

Dr. Herong Yang, updated in 2009
Encoding Conversion Programs for Encoded Text Files