[Openmcl-devel] *default-external-format* and encoding and decoding strings.

Ron Garret ron at flownet.com
Mon Mar 7 23:07:17 UTC 2016


On Mar 7, 2016, at 2:36 PM, Ron Garret <ron at flownet.com> wrote:

> 
> On Mar 7, 2016, at 1:30 PM, R. Matthew Emerson <rme at clozure.com> wrote:
> 
>> 
>>> On Mar 5, 2016, at 12:03 PM, Ron Garret <ron at flownet.com> wrote:
>>> 
>>> 
>>> On Mar 5, 2016, at 8:39 AM, Dmitry Igrishin <dfigrish at gmail.com> wrote:
>>> 
>>>> 
>>>> 
>>>> 2016-03-05 16:25 GMT+03:00 Dmitry Igrishin <dfigrish at gmail.com>:
>>>> Hello,
>>>> 
>>>> The *default-external-parameter* doesn't considered by
>>>> count-characters-in-octet-vector, decode-string-from-octets,
>>>> encode-string-to-octets, string-size-in-octets functions which
>>>> has the :external-format parameter. I believe that
>>>> *default-external-parameter* should affect the behaviour of
>>>> all functions with :external-format parameter, right?
>>>> Sorry, I meant the *default-external-format* special variable...
>>> 
>>> This is a bug in ccl::lookup-character-encoding.  Here’s a patch:
>>> 
>>> (in-package :ccl)
>>> 
>>> (let ((ccl::*warn-if-redefine-kernel* nil))
>>> (defun lookup-character-encoding (name)
>>>   (gethash (or name *default-external-format*) *character-encodings*)))
>> 
>> I don't think I can apply this.
>> 
>> The issue is that nil is a valid character encoding name: it's a documented synonym for :iso-8859-1.
> 
> That’s a bug in the documentation.  NIL should be a synonym for *default-character-encoding*.  (I’m not joking.  That part of the docs was written before the introduction of *default-character-encoding*.)

Whoops, I take that back.  The docs are correct (or at least defensible).  They say:

"The default, default character encoding is NIL which is a synonym for :ISO-8859-1.”

So this has to be fixed upstream, where you can still tell the difference between a user specifying NIL and simply not passing an argument.

But you still might want to consider changing NIL being a synonym for :ISO-8859-1 rather than for *default-external-format*.  That seems to me to cause more trouble than it’s work at this point.

rg



More information about the Openmcl-devel mailing list