[Openmcl-devel] *default-character-encoding* should be :utf-8
Gary Byers
gb at clozure.com
Sat Mar 3 16:38:24 PST 2012
On Sat, 3 Mar 2012, Vladimir Sedach wrote:
> Hello,
>
> The default Clozure character encoding for LOADing files is currently
> unspecified, and defaults to latin-1 (at least on my machine).
Section 4.5.2 of the manual says that the default character encoding
used for I/O on text files is determined by the value of
CCL:*DEFAULT-FILE-CHARACTER-ENCODING*. It doesn't explicitly say that
LOAD, COMPILE-FILE, and OPEN involve (in the relevant cases) I/O on
text files; if it did, people might be less likely to say or think
that the default encoding used by LOAD is unspecified.
> would be much better to make the default utf-8 - there is no standard
> way of specifying the default encoding for LOAD (IMO a big omission
> from the CL standard), and ASDF makes no provision for specifying
> source file encoding either. At least SBCL and CLISP default to utf-8,
> so files with non-ascii strings and symbols load fine, but if I want
> to load the same system in CCL, right now I first need to set
> *default-character-encoding* to utf-8.
CL says that LOAD, COMPILE-FILE, and OPEN all accept :EXTERNAL-FORMAT
arguments (that default to the value :DEFAULT). It doesn't say anything
about how implementations handle other values, so something like:
(LOAD file :external-format :utf-8)
works in some implementations (including CCL) but not others.
>
> The fix is rather modest - l1-sysio.lisp, line 87 should be:
> (defvar *default-file-character-encoding* :utf-8)
Another way to fix this is to set *DEFAULT-FILE-CHARACTER-ENCODING*
in your init file; that would have less impact on users for whom
:UTF-8 isn't better.
>
> Thank you,
> Vladimir
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>
>
More information about the Openmcl-devel
mailing list