Nico Heinze wrote: > --- In [email protected], "Anthony Appleyard" <[EMAIL PROTECTED]> > wrote: >> These queries arose when I was updating a C++ program >> that handles files. >> From early computers in the 1960's, text files have been >> easy to understand: a long succession of 8-bit characters, >> with CR and LF as about the only serious complication. >> >> But the coming of Unicode has complicated that, with need >> to distinguish one 16-bit Unicode character from two >> adjacent 8-bit ANSI characters. For example, the old >> ever-so-simple Windows Notepad program now when printing >> asks the user to choose between these four modes: >> ANSI, Unicode, Unicode big endian, UTF-8. >> >> Please where is a full description of all .TXT (text) >> file modes, all the information being together? > <snip> > > text files; IIRC, Unicode text files are introduced by the two bytes > 0xff 0xfe, then every pair of bytes denotes one character; I don't > know how UTF-8 files are handled...
The two bytes are called the Byte Order Mark (BOM) and are not required if the parser knows it is a Unicode document. MyProBB, although written in PHP, has extensive UTF-8 support. The beauty of UTF-8 is that it supports almost all of 7-bit ASCII. A UTF-8 parser can read most plain text files without skipping a beat. The downside to UTF-8 is that non-ASCII characters, particularly of the Eastern (Chinese, Japanese) variety take about 3 characters to represent a single character. Because UTF-8 uses a variable character length, you have to access the data sequentially when programming for it. I'd say UTF-8 and UTF-16 are the two big players in existence. Most web apps. use UTF-8 because of broad browser support. Client-side apps. usually use UTF-16 because of its simplicity for programming purposes. I don't like Unicode (neither do the Chinese, Japanese, and Klingons). I also don't like ASCII. But UTF-8 is a decent balance between the two worlds. -- Thomas Hruska CubicleSoft President Ph: 517-803-4197 *NEW* MyTaskFocus 1.1 Get on task. Stay on task. http://www.CubicleSoft.com/MyTaskFocus/
