Download TextWrangler 4.5.3 User Manual
Transcript
Saving Unicode Files TextWrangler lets you save documents that use character set encodings other than Mac Roman, even multi-byte character sets. When saving a file, you can choose to save text composed in any script with any encoding. In addition to the standard character set encodings, TextWrangler also lets you save the files in a variety of plain Unicode files: • Unicode (UTF-8): UTF-8 without a byte-order mark • Unicode (UTF-8, with BOM): UTF-8 with a byte-order mark (BOM) • UTF-16 Little-Endian • UTF-16 Little-Endian, no BOM • UTF-16 • UTF-16, no BOM IMPORTANT The naming convention TextWrangler follows for UTF-8 documents has changed from that used by versions before 3.5: the encoding name “Unicode (UTF-8)” now refers to files without a byte-order mark (BOM), while the specific name “Unicode (UTF-8, with BOM)” refers to files which have a BOM. Here are details about what each of the above options means: • UTF-8: UTF-8 encoding is a more compact variant of Unicode that uses 8-bit tokens where possible to encode frequently used sequences from the file. (This format makes it easier to view and edit content in non-Unicode-aware editors.) • UTF-16: UTF-16 encoding always uses 16-bit tokens. • BOM: When saving Unicode files, you may include a byte-order mark (BOM) so that the reading application knows what byte order the file’s data is in. However, since many applications do not correctly handle files which contain BOMs, you may wish to use an encoding variant without a BOM for maximum compatibility. (For purposes of recognition when you use this option, the UTF-16 BOM is FEFF, and the UTF-8 BOM is EFBBBF.) • Little-Endian: Since UTF-16 uses two bytes to represent each character, this leaves the question of which of the two bytes comes first—whether it is “little-endian” or “big-endian.” By default, TextWrangler writes UTF-16 big-endian (the standard). By choosing one of the “Little-Endian” (or “byte-swapped”) encodings, you can write little-endian files instead, which some Windows software requires. Files saved as Unicode from TextWrangler are given a type of ‘utxt’—the standard for Unicode text files on the Mac. UTF-8 files are given a type of ‘TEXT’ for compatibility with other applications; however, TextWrangler will also recognize such files with type ‘UTF8’. Opening Unicode Files When opening files, TextWrangler will ordinarily determine the format of a file based on its file type and content, and automatically process Macintosh text, Unicode, and UTF-8. However, some files are structured such that TextWrangler is unable to correctly determine their format based on their type or contents. The cases that we know of are: 48 Chapter 3: Working with Files