bug-gnu-libiconv
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gnu-libiconv] iconv(3) return value


From: Jeffrey Walton
Subject: Re: [bug-gnu-libiconv] iconv(3) return value
Date: Fri, 23 Sep 2011 13:31:54 -0400

On Fri, Sep 23, 2011 at 1:23 PM, Bruno Haible <address@hidden> wrote:
> Hi,
>
> Jeffrey Walton asked:
>> According to 
>> http://www.gnu.org/s/libiconv/documentation/libiconv/iconv.3.html:
>>
>>   RETURN VALUE
>>     The iconv function returns the number of characters converted in a
>>     non-reversible way during this call; reversible conversions are not
>>     counted. In case of error, it sets errno and returns (size_t)(-1).
>>
>> I'm not clear if it is the number of characters in the input buffer,
>> or number of characters output buffer?
>
> Don't confuse the concept of "characters" with the concept of "bytes".
Yes, I'm pretty good with this concept. I try to forget any
preconceived notions.

> The return value is the number of characters that could not be reversibly
> converted. For example, if the 'from' character set has a 'MICRO SIGN'
> character and the 'to' character set does not have it, but has a
> 'GREEK SMALL LETTER MU', and iconv() uses that as a replacement,
> the conversion from 'MICRO SIGN' to 'GREEK SMALL LETTER MU' would be a
> non-reversible conversion. This notion is independent of byte array
> sizes.
Ah, OK. It returns the number of character which could *not* be
converted. For some reason, my reading was not clear.

Thanks,
Jeff



reply via email to

[Prev in Thread] Current Thread [Next in Thread]