All Manuals > LispWorks User Guide and Reference Manual > 22 Internationalization > 22.6 External Formats and File Streams > 22.6.3 Guessing the external format

NextPrevUpTopContentsIndex Example of using UTF-8 by default

To change the default for all file access via open, compile-file and so on, you can modify the value of *file-encoding-detection-algorithm*.

For example given the following definition:

(defun utf-8-file-encoding (pathname ef-spec buffer length)
  (declare (ignore pathname buffer length))
  (system:merge-ef-specs ef-spec :utf-8))

then this makes it use UTF-8 as a fallback:

(setq system:*file-encoding-detection-algorithm*
      (substitute 'utf-8-file-encoding

and this forces it to always use UTF-8:

(setq system:*file-encoding-detection-algorithm*

LispWorks User Guide and Reference Manual - 21 Dec 2011