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

Saving Files in "Unicode" Option

This section provides a tutorial example on how to save text files with Nodepad by selecting the Unicode encoding option on the save file dialog box.

In the next test, I want to try the save function with the Unicode encoding.

1. Run Notepad and open hello.utf-8 correctly with the UTF-8 encoding option selected.

2. Click the File > "Save As" menu. The "Save As" dialog box comes up.

3. Enter notepad_utf-16le as the new file name and select "Unicode" option in the Encoding field.
Notepad Save UTF-16LE File

4. Click the Save button. Notepad saves the text to a new file named as: notepad_utf-16le.txt.

5. To see how my text is saved by Notepad, I need to run my HEX dump program on notepad_utf-16le.txt:

C:\herong\uni\unicode>java HexWriter notepad_utf-16le.txt
   notepad_utf-16le.hex

Number of input bytes: 170

C:\herong\unicode>type notepad_utf-16le.hex
FFFE480065006C006C006F0020006300
6F006D00700075007400650072002100
20002D00200045006E0067006C006900
730068000D000A0035751181604F7D59
01FF20002D002000530069006D007000
6C006900660069006500640020004300
680069006E006500730065000D000A00
FB966681604F7D5957FE20002D002000
54007200610064006900740069006F00
6E0061006C0020004300680069006E00
6500730065000D000A00

Very nice. This is a perfect UTF-16 encoding file using the Little-Endian with BOM format. Those leading 2 bytes represent the BOM flag, which is not part of the text.

Conclusion - The "Unicode" encoding option of Notepad matches the "Little-Endian with BOM" format of Unicode UTF-16 encoding.

Sections in This Chapter

What Is Notepad?

Opening UTF-8 Text Files

Opening UTF-16BE Text Files

Opening UTF-16LE Text Files

Saving Files in UTF-8 Option

Byte Order Mark (BOM) - FEFF - EFBBBF

Saving Files in "Unicode Big Endian" Option

Saving Files in "Unicode" Option

Supported Save and Open File Formats

Dr. Herong Yang, updated in 2009
Saving Files in "Unicode" Option