[Openmcl-devel] implications of setting *default-file-character-encoding* to :utf-8

R. Matthew Emerson rme at clozure.com
Thu Sep 16 13:43:09 PDT 2010


On Sep 16, 2010, at 3:27 PM, R.Stoye wrote:

> Hi,
> 
> i use to set *default-file-character-encoding* to :utf-8 since it is easier when dealing with a lot of files containing german umlaut characters.
> But i have had some small problems with that aproach using Hunchentoot and file uploads:
> 
> The library rfc2388 uses faithful I/O  (http://cl-cookbook.sourceforge.net/io.html#faith) which fails under this conditions.
> Before sending a patch to the maintainer of rfc2388 i just want to ask which of the following is better/faster:
> a) to bind *default-file-character-encoding* to nil just before the creation of the filestream, or
> b) include an :external-format (ccl::make-external-format :character-encoding :iso-8859-1 :line-termination :unix) in the call to with-open-file

Option b is the better approach.  Note that ccl:make-external-format is an exported symbol.  You can also just pass a plist as the value of the :external-format keyword argument, e.g. :external-format '(:character-encoding :iso-8859-1 :line-termination :unix).

http://ccl.clozure.com/ccl-documentation.html#External-Formats

> Further i would like to know if there may appear further problems when i change the default character-encoding.
> (One i'am aware of is that asdf-install can't download packages anymore, but since i don't use that very often i can circumvent this problem)

One reason that :iso-8859-1 is the default external format is that it's an 8-bit encoding, and therefore covers a multitude of sins.  What I mean by that is even if you open a file of random binary data as an :iso-8859-1 character stream, you can get away with reading characters anyway.


More information about the Openmcl-devel mailing list