All Manuals > LispWorks Editor User Guide > 6 Advanced Features > 6.3 Programming the editor > 6.3.7 Files

NextPrevUpTopContentsIndex File encodings in the editor

An editor buffer ideally should have an appropriate external format (or encoding) set before you write it to a file. Otherwise an external format specified in the value of the editor variable output-format-default is used. If the value of output-format-default is not an external-format specifier, then the external format is chosen similarly to the way cl:open does it. By default this chosen external format will be the Windows code page on Microsoft Windows, and Latin-1 on other platforms.

When using the Editor tool, use Set External Format to set interactively the external format for the current buffer, or set Preferences... > Environment > File Encodings > Output (which in turn sets the editor variable output-format-default) to provide a global default value.

In an application which writes editor buffers to file, you can do this to set the external format of a given buffer:

(setf (editor:buffer-external-format buffer ) ef-spec )

You can also set a global default external format for editor buffers:

(setf (editor:variable-value 'editor:output-format-default

Then ef-spec will be used when a buffer itself does not have an external format.

LispWorks Editor User Guide (Macintosh version) - 3 May 2011