Portable interface to character encodings and your implementation's external-format

Upstream URL


Francois-Rene Rideau


Not determined

ASDF-ENCODINGS This library allows you to use ASDF with Lisp source files that use an encoding different from either ASCII or UTF-8. It depends on ASDF 2.21 or later (actually 2.20.18 or later). TODO: (1) actually support more implementations. (2) Add a test suite. (3) Test it. (4) Add more corner cases. ==== Exported Functionality ==== The asdf-encodings defines a package ASDF-ENCODINGS. It uses ASDF 2.21's asdf:*encoding-external-format-hook* to define a simple mapping from encodings specified as portable keywords to implementation-defined external formats. It issues warnings or errors when no matching external-format is available, depending on asdf-encodings. function ENCODING-EXTERNAL-FORMAT (ENCODING &KEY (ON-ERROR *ON-UNSUPPORTED-ENCODING*)) This function takes a keyword which is one of :default :utf-8 :utf8 :latin1 :latin-1 :iso-8859-1 a whole lot of other possibilities as per asdf-encodings::*encodings* and returns a value suitable for use as :external-format argument to the current implementation's CL:OPEN, CL:LOAD or CL:COMPILE-FILE functions. If the encoding is not supported on this implementation, the ON-ERROR argument, which is one of :ERROR, :WARN, NIL, specifies what to do. variable *ON-UNSUPPORTED-ENCODING* One of :error, :warn or nil, specifies what to do when passed an unsupported encoding. Defaults to :error. function DETECT-FILE-ENCODING (PATHNAME) This function takes a pathname designator, and returns a portable encoding as detected by the file contents, either an emacs-style -*- coding: foo -*- declaration, or something deduced from the octet patterns in the file. function NORMALIZE-ENCODING (ENCODING) Given a portable encoding keyword, returns the normalized keyword describing that encoding on the current implementations, if any, or NIL if the encoding is not present on the implementation (or not recognized by asdf-encodings). function FIND-IMPLEMENTATION-ENCODING (ENCODING) Given a normalized encoding keyword, returns an external-format suitable for use on the current implementation, if any.

Dependencies (2)

  • fare-utils
  • hu.dwim.stefil
  • GitHub
  • Quicklisp