bug-texinfo
[Top][All Lists]
Advanced

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

Re: Using iconv in stand-alone info


From: Gavin Smith
Subject: Re: Using iconv in stand-alone info
Date: Wed, 23 Dec 2015 19:15:18 +0000

On 23 December 2015 at 18:48, Eli Zaretskii <address@hidden> wrote:
>> Date: Wed, 23 Dec 2015 20:23:41 +0200
>> From: Eli Zaretskii <address@hidden>
>> Cc: address@hidden
>>
>> Yes, you are right, I think I should change the logic there.  Will
>> resubmit.
>
> Btw, can you tell why you needed this logic:
>
>       /* We want to read exactly one character.  Do this by
>          restricting size of output buffer. */
>       utf8_char_ptr = utf8_char;
>       for (i = 1; i <= 4; i++)
>         {
>           utf8_char_free = i;
>           iconv_ret = iconv (iconv_to_utf8, &inptr, &bytes_left,
>                              &utf8_char_ptr, &utf8_char_free);
>           /* If we managed to write a character: */
>           if (utf8_char_ptr > utf8_char) break;
>         }
>
> Why cannot you restrict the size of input instead?

I really can't remember for sure (it was like that in the earliest
version of the code I posted to this list in Feb. 2014). The only
possible reason I've been able to think of just now is that the
maximum length in bytes required in the input to get an output
character is unknown (the input character could be preceded by a
locking shift sequence of a few bytes, for example), but for the
output it's known that no UTF-8 character can be more than 4 bytes.



reply via email to

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