[Top][All Lists]

[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 18:03:15 +0000

On 23 December 2015 at 17:38, Eli Zaretskii <address@hidden> wrote:
> Attached.  OK to commit?

Thanks. It looks mostly OK; it would be good to have a comment
explaining why we have to call iconv a second time.

There's one part that there could be a problem with, if I understand correctly:

> @@ -918,7 +920,13 @@ copy_converting (long n)
>            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;
> +          if (utf8_char_ptr > utf8_char)
> +           {
> +             if (iconv_ret == (size_t) -1)
> +               iconv_ret = iconv (iconv_to_utf8, NULL, NULL,
> +                                  &utf8_char_ptr, &utf8_char_free);
> +             break;
> +           }
>          }
>        /* errno == E2BIG if iconv ran out of output buffer,

If it's true that iconv will delay writing to the output buffer until
it sees the next character in case it is a combining character, then
it's possible that this condition will never be satisfied. What comes
to mind is checking whether the input pointer was advanced (rather
than the output pointer), but maybe you'll have a better idea.

If you had any test files where characters are disappearing, it would
be interesting if I could see them.

reply via email to

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