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 the Editor File Encodings Output preference (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
:global)
ef-spec )
Then ef-spec will be used when a buffer itself does not have an external format.