File Format

While plain-text is probably the simplest and most interchangeable file format in the computer world, there is still variation in what plain-text means from system to system. Plain-text files can differ in character set, line termination, and wrapping.

While character set differences are the most obvious and pose the most challenge to portability, they affect XNEdit only indirectly via the same font and localization mechanisms common to all X applications. If your system is set up properly, you will probably never see character-set related problems in XNEdit.

The primary difference between an MS DOS format file and a Unix format file, is how the lines are terminated. Unix uses a single newline character. MS DOS uses a carriage-return and a newline. XNEdit can read and write both file formats, but internally, it uses the single character Unix standard. XNEdit auto-detects MS DOS format files based on the line termination at the start of the file. Files are judged to be DOS format if all of the first five line terminators, within a maximum range, are DOS-style. To change the format in which XNEdit writes a file from DOS to Unix or visa versa, use the Save As... command and check or un-check the MS DOS Format button.

Wrapping within text files can vary among individual users, as well as from system to system. Both Windows and MacOS make frequent use of plain text files with no implicit right margin. In these files, wrapping is determined by the tool which displays them. Files of this style also exist on Unix systems, despite the fact that they are not supported by all Unix utilities. To display this kind of file properly in XNEdit, you have to select the wrap style called Continuous. Wrapping modes are discussed in the sections: Customizing -> Preferences, and Basic Operation -> Shifting and Filling.

The last and most minute of format differences is the terminating newline. Some Unix compilers and utilities require a final terminating newline on all files they read and fail in various ways on files which do not have it. Vi and approximately half of Unix editors enforce the terminating newline on all files that they write; Emacs does not enforce this rule. Users are divided on which is best. XNEdit makes the final terminating newline optional (Preferences -> Default Settings -> Terminate with Line Break on Save).