Subject: Re: [clisp-list] help about [ clisp-Bugs-550603 ] UTF-16 min/max_ bytes_per_char mu st be 2

From: "Hoehle, Joerg-Cyril" <[email-masked]>
Date: Fri May 17 07:05:03 2002

Sam Steingold wrote:
>> Sadly, min_bytes_per_char still looks like the solution - if
>> the slots were correct for all encodings, which they are obviously
>> not for UTF-16 (must be 2;2, but is 1;8 nonsense for UTF-16).
>
>this cannot be done properly for iconv-based encodings since there is
>no way to query libiconv for this information.
>I think these are set correctly for built-in encodings.

Sadly, having incorrectly set slots not only hinders WITH-FOREIGN-STRING, but also breaks other parts of the system which rely on correct information.

Example of another bug:
> (setf custom:*foreign-encoding* (ext:make-encoding :charset "ISO-8859-1"))
*** - SYSTEM::SET-FOREIGN-ENCODING: #<ENCODING "ISO-8859-1" :UNIX> is not a 1:1 encoding

This error is complete nonsense, "ISO-8859-1" is a 1:1 encoding we all know, except that CLISP checks the misdefined min/max_bytes_per_char slots of this external encoding and errors.

Obviously, having correct min/max is the "better" solution.

Microsoftian advice: "don't do that. Use :charset charset:iso-8859-1. Impnotes says that built-in encodings are preferred".

BTW, Impnotes says: "When an encoding is available as a built-in and through iconv(), the built-in is preferred, because it is more efficient and available across platforms."

I find this confusing, "preferred" by who?
Does that mean that CLISP automatically switches to an built-in one? Does that mean that the programmer ought to use built-in using charset:name instead of "name"?
I'd suggest a wording like: "..., we recommend using the built-in one, because ..."

Regards,
	Jorg Hohle.

---

From: Sam Steingold <[email-masked]>
Date: Fri May 17 08:22:03 2002

> * In message <[email-masked]>
> * On the subject of "Re: [clisp-list] help about [ clisp-Bugs-550603 ] UTF-16 min/max_ bytes_per_char mu st be 2"
> * Sent on Fri, 17 May 2002 16:04:34 +0200
> * Honorable "Hoehle, Joerg-Cyril" <[email-masked]> writes:
>
> Sam Steingold wrote:
> Sadly, having incorrectly set slots not only hinders
> WITH-FOREIGN-STRING, but also breaks other parts of the system which
> rely on correct information.
> 
> Example of another bug:
> This error is complete nonsense, "ISO-8859-1" is a 1:1 encoding we all
> know, except that CLISP checks the misdefined min/max_bytes_per_char
> slots of this external encoding and errors.
> 

so how do we find out that some iconv encoding is 1:1?

> Microsoftian advice: "don't do that. Use :charset
> charset:iso-8859-1. Impnotes says that built-in encodings are
> preferred".
> 
> BTW, Impnotes says: "When an encoding is available as a built-in and
> through iconv(), the built-in is preferred, because it is more
> efficient and available across platforms."
> 
> Does that mean that CLISP automatically switches to an built-in one?

I suggest that we do exactly this.
it is not clear that this is TRT though: it is conceivable that someone
will want to use the iconv encoding, e.g., to check it against the
CLISP built-in.

> Does that mean that the programmer ought to use built-in using
> charset:name instead of "name"?

yes, this is what is meant now.

-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat7.2 GNU/Linux
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html>
When we write programs that "learn", it turns out we do and they don't.