Re: display of CP-1258
On Tuesday, February 24, 2004 at 12:56:36 PM +0100, Bruno Haible wrote:
> Alain Bench wrote:
>> Wouldn't it be possible to temporarily unread the innocent 'u' char
>> when iconv() sees it doesn't combine with stored state, so before '½'
>> output and possible EILSEQ return?
> I don't think that's how iconv() is supposed to work.
Internally OK, my suggestion is naive. But man 3 iconv says that in
the EILSEQ case:
| An invalid multibyte sequence is encountered in the input. In this
| case it sets errno to EILSEQ and returns (size_t)(-1). *inbuf is left
| pointing to the beginning of the invalid multibyte sequence.
I understand that "invalid" here means invalid *or* unconvertable.
But *inbuf was left pointing to the valid 'u', *after* the unconvertable
sequence 0x9C (following the now fixed initial example).
>>| Read 9 bytes and wrote 8 bytes
> iconv(cd,NULL,NULL,&ob,&obl)
OK, thanks: It works better like this! ;-)
Bye! Alain.
--
Give your computer's unused idle processor cycles to a scientific goal:
The Genome@home project at <URL:http://genomeathome.stanford.edu/>.