[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Standalone Info reader cannot read Info files with CR-LF EOLs
From: |
Gavin Smith |
Subject: |
Re: Standalone Info reader cannot read Info files with CR-LF EOLs |
Date: |
Wed, 14 Jan 2015 18:06:37 +0000 |
On Wed, Jan 14, 2015 at 5:57 PM, Eli Zaretskii <address@hidden> wrote:
>> Date: Wed, 14 Jan 2015 10:42:08 +0000
>> From: Gavin Smith <address@hidden>
>> Cc: Texinfo <address@hidden>
>>
>> int
>> wcwidth (wchar_t wc)
>> #undef wcwidth
>> {
>> /* In UTF-8 locales, use a Unicode aware width function. */
>> const char *encoding = locale_charset ();
>> if (STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0 ,0))
>> {
>> /* We assume that in a UTF-8 locale, a wide character is the same as a
>> Unicode character. */
>> return uc_width (wc, encoding);
>> }
>> else
>> {
>> /* Otherwise, fall back to the system's wcwidth function. */
>> #if HAVE_WCWIDTH
>> return wcwidth (wc);
>> #else
>> return wc == 0 ? 0 : iswprint (wc) ? 1 : -1;
>> #endif
>> }
>> }
>>
>> locale_charset is always called every time.
>
> Yes, I know. But only if gnulib's wcwidth is used. Is it used on
> your platform? AFAIK, glibc provides wcwidth, so I'd expect the
> gnulib version not to be used on your platform.
Right, I was forgetting that the gnulib version won't be used if the
function exists.
>
> In any case, I don't see why we need to call locale_charset for each
> and every character, over and over and over again. We should call it
> once and then reuse the result, since it depends on the environment
> outside the reader, and will not change during the session, right?
I raised this issue on the gnulib list here:
http://lists.gnu.org/archive/html/bug-gnulib/2015-01/msg00040.html.
One idea is to add another function to gnulib where the encoding is
passed as a parameter.
- Re: Standalone Info reader cannot read Info files with CR-LF EOLs, Gavin Smith, 2015/01/01
- Re: Standalone Info reader cannot read Info files with CR-LF EOLs, Eli Zaretskii, 2015/01/02
- Re: Standalone Info reader cannot read Info files with CR-LF EOLs, Gavin Smith, 2015/01/02
- Re: Standalone Info reader cannot read Info files with CR-LF EOLs, Eli Zaretskii, 2015/01/02
- Re: Standalone Info reader cannot read Info files with CR-LF EOLs, Eli Zaretskii, 2015/01/03
- Re: Standalone Info reader cannot read Info files with CR-LF EOLs, Gavin Smith, 2015/01/03
- Re: Standalone Info reader cannot read Info files with CR-LF EOLs, Gavin Smith, 2015/01/08
- Re: Standalone Info reader cannot read Info files with CR-LF EOLs, Eli Zaretskii, 2015/01/10
- Re: Standalone Info reader cannot read Info files with CR-LF EOLs, Gavin Smith, 2015/01/14
- Re: Standalone Info reader cannot read Info files with CR-LF EOLs, Eli Zaretskii, 2015/01/14
- Re: Standalone Info reader cannot read Info files with CR-LF EOLs,
Gavin Smith <=