Lugaru's Epsilon
Programmer's
Editor 14.04

Context:
Epsilon User's Manual and Reference
   Commands by Topic
      Buffers and Files
         Buffers
         Files
            . . .
            Backup Files
            File Name Templates
            Line Translation
            DOS/OEM Character Set Support
            File Name Prompts
            . . .
         File Variables
            Directory-wide File Variables
            Vi/Vim File Variables
         . . .

Previous   Up    Next
File Name Templates  Commands by Topic   DOS/OEM Character Set Support


Epsilon User's Manual and Reference > Commands by Topic > Buffers and Files > Files >

Line Translation

Most Windows programs use files with lines separated by the pair of characters Return, Newline (or Control-M, Control-J), just as DOS did. But internally Epsilon separates lines with just the newline character, Ctrl-j. Epsilon normally translates between the two systems automatically when reading or writing text files in this format. When it reads a file, it removes all Ctrl-m characters, and when it writes a file, it adds a Ctrl-m character before each Ctrl-j.

Epsilon will automatically select one of several other translation types when appropriate, based on the contents of the file you edit. It automatically determines whether you're editing a regular file, a binary file, a Unix file, or an old Mac file (since OS X, Macs have used Unix-style text files), and uses the proper translation scheme. You can explicitly override this if necessary. Epsilon determines the file type by looking at the first few hundred thousand bytes of the file, and applying heuristics. This is quite reliable in practice. However, Epsilon may occasionally guess incorrectly. You can tell Epsilon exactly which translation scheme to use by providing a numeric argument to a file reading command like find-file, or a file-writing command like save-file or write-file. Epsilon will then prompt for which translation scheme to use.

The set-line-translate command sets this behavior for the current buffer. It prompts for the desired type of translation, and makes future file reads and writes use that translation. Epsilon will display "Binary", "Unix", "DOS", or "Mac" in the mode line to indicate any special translation in effect. (It omits this when the "usual" translation is in effect: Unix files in Epsilon for Unix, DOS files in other versions.)

Set the default-translation-type variable if you want to force Epsilon to always use a particular type of translation when reading existing files, rather than examining their contents and choosing a suitable type. A value of 0 forces binary, 1 forces DOS/Windows, 2 forces Unix, and 3 forces Macintosh. A value of 5, the default, lets Epsilon autodetect the file type.

Set the new-buffer-translation-type variable if you want Epsilon to create new buffers and files with a translation type other than the default. For file names that start with ftp://, the ftp-ascii-transfers variable can changes the meaning of some translation types; see its online help.

For file names in the form of a URL, Epsilon uses the force-remote-translation-type variable instead of default-translation-type. When it's not set to 5 to request auto-detection, it makes Epsilon use one specific translation type for all remote files, bypassing auto-detection.

Setting the fallback-remote-translation-type variable instead lets auto-detection proceed, but sets the translation type Epsilon uses whenever it can't determine a type by examining the file, and for new files. The default value, 5, makes Epsilon for Unix pick Unix, and Epsilon for Windows pick DOS/Windows. This variable is the remote-file equivalent of new-buffer-translation-type.

Host-specific variables takes precedence over both force-remote-translation-type and fallback-remote-translation-type, letting you establish separate settings for each remote system. See these variables' full descriptions for details.

Epsilon remembers the type of translation you want in each buffer using the buffer-specific variable translation-type.

You can use the "write-line-translate" file variable to set Epsilon so it auto-detects the translation rule when reading existing files, but forces all files into a specific mode when saving them. See File Variables.

Epsilon applies the following heuristics, in order, to determine a file's type. These may change in future versions.

A file that contains null bytes is considered binary. A file that has no Ctrl-m Ctrl-j pairs is considered a Unix file if it contains Ctrl-j characters, or a Macintosh file if it contains Ctrl-m. A file containing a Ctrl-m character not followed by either Ctrl-m or Ctrl-j is considered binary. So is a file containing a Ctrl-j character not preceded by a Ctrl-m as well as some Ctrl-m Ctrl-j pairs. Any other files, or files of less than five characters, are considered to be in standard DOS/Windows format (or in Epsilon for Unix, Unix format).

Bear in mind that Epsilon makes all these decisions after examining only the first few hundred thousand bytes of a file, and phrases like "contains null bytes" really mean "contains null bytes in its first few hundred thousand characters." When Epsilon chooses a file type based on text far from the start of the file, so that the reason for the choice may not be obvious, it displays a message explaining why it picked that translation type. The file-read-kibitz variable controls this.

Standard bindings:

    set-line-translate
 



Previous   Up    Next
File Name Templates  Commands by Topic   DOS/OEM Character Set Support


Lugaru Epsilon Programmer's Editor 14.04 manual. Copyright (C) 1984, 2021 by Lugaru Software Ltd. All rights reserved.