Hi
I'm restarting a very old thread:
Bruno Haible wrote on 21. Mai 2002
>> > Obviously, having correct min/max is the "better" solution.
>Yes, it would, but it is too much maintenance overhead, given that
>iconv by itself doesn't provide this information.
It's time to raise this thread again because whoever (Sam?) added the non-1:1 support to the FFI will run into this issue.
For example, encoding.d:SET-FOREIGN-ENCODING has code checking max_bytes_per_char.
My observation & report, back in 2002, was that those min/max fields of the encoding structure were not all reliable. Bruno's more precise answer IIRC was that they were ok for CLISP's built-in encodings and junk for iconv() based ones.
That's why I invented SYS::ENCODING-ZEROES, which I needed for WITH-FOREIGN-STRING.
Now, in 2005, what's changed? Is SET-FOREIGN-ENCODING operating on sensible data?
a) nothing changed, thus code must not depend on min/max_bytes_per_char
and the 1:1 check set-foreign-encoding does is questionable
-- or needs precise documentation about why it is expected to work.
b) the min/max fields are ok nowadays, thus encoding-zeroes belongs to the past.
Then, WITH-FOREIGN-STRING could take advantage of these fields.
Looking at encoding.d, I'd guess situation a) applies.
Regards,
Jorg Hohle.
|