ANSICONV: ANSI <--> DOS Character Conversion -------------------------------------------- Introduction ------------ Most of the .DBF files on this CD-ROM contain both English and French text. The French accented characters are represented by the ANSI character set, not the DOS character set. ANSI is the native character set of Arc/Info and most Windows applications, including SurView (which displays the accented characters correctly). The Problem ----------- If you attempt to view/edit any of the .DBF files with most Microsoft Windows spreadsheet or database programs (i.e. Excel, Quattro Pro, Access), you will destroy all of the French accented characters. Although these applications are all Windows applications, they assume that the .DBF files contain only DOS characters (since they are considered to be 'DOS' files). Therefore, when ANSI characters are encountered, they are unrecognized and are converted to '_' or 'T', depending on the application. If you then 'Save' the .DBF file, the file will contain the '_' and all of the accented characters will have been destroyed. Note that some of these applications have an option for ANSI or DOS text when importing 'text' files, but there is no such option for DBF files. Example ------- To illustrate the difference between the ANSI & DOS character sets, start up the DOS EDITor and enter the following 2 characters, by holding down the ALT key while entering the 3 digits on the numeric keypad. Then release the ALT key: ALT 130 "e accent acute" using the DOS character set ALT 233 "e accent acute" using the ANSI character set You should see 2 characters: 'e accent acute' 'a theta symbol' Now save the file (any name, i.e. XXX.TXT). Start up the Microsoft Windows Notepad application and open the XXX.TXT file. You will now see 2 different characters: 'a block' 'e accent acute' This demonstrates that DOS EDIT can display the DOS characters correctly, but not the ANSI characters. Conversely, Microsoft Windows Notepad can display the ANSI characters correctly, but not the DOS characters. The Solution ------------ In order to edit or view these .DBF files without destroying the accented characters, they must be first translated from ANSI to DOS characters, even if you are using a Windows application to open the .DBF files. In addition to LF <--> CRLF translation, the unix2dos & dos2unix utilities can also convert between ANSI (ISO) & DOS with the -iso option, but you must NOT use this utility on .DBF files, since they have a binary header that must NEVER be translated. Instead, use the ANSICONV.EXE utility supplied on this CD-ROM to convert the files. It can convert .DBF or text files between DOS and ANSI character sets. For text files, it converts all characters: for .DBF files, it leaves the header untouched and converts the remaining characters. Procedure to Edit .DBF files ---------------------------- 1. Use the ANSICONV.EXE utility to convert the DBF file from ANSI to DOS 2. Open the DOS DBF file and edit it as you wish 3. Save the DBF file (you have no ANSI/DOS choice: it will be saved using the DOS character set) 4. Use the ANSICONV.EXE utility to convert the DOS DBF file from DOS back to ANSI. If you have any questions about the ANSICONV utility or the issue of DOS/ANSI character sets, do not hesitate to contact the author anytime: John A. Grant Earth Sciences Sector Geological Survey of Canada Mineral Resources Division 601 Booth St., Room 591 Ottawa, Ontario, K1A 0E8 Phone: (613) 992-1082 FAX: (613) 996-3726 e-mail: jagrant@gsc.nrcan.gc.ca