--- 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>
Look under www.unicode.org ; the site is quite huge but has all the information you're going to need. One shortcut here: mixing 8-bit and 16-bit characters in one text file is possible but extremely bad style. I know no one who still does it nowadays. Usually you will have either 8-bit text files or Unicode 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... You will want to look up the following items first: - plain 8-bit files, - UTF-8 representation (basically maps all non-NUL Unicode characters to one, two, or three single bytes all of which are no NUL byte), - UCS-2 representation (two bytes per character, and that's it), - UCS-4 representation (extremely rare, not even IBM's DB2 can handle them). Regards, Nico
