Re: Fix u32toutf8 so it encodes values > 0xFFFF correctly.
From:
Eric Blake
Subject:
Re: Fix u32toutf8 so it encodes values > 0xFFFF correctly.
Date:
Tue, 21 Feb 2012 05:34:06 -0700
User-agent:
Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120209 Thunderbird/10.0.1
On 02/20/2012 07:42 PM, Chet Ramey wrote:
> On 2/18/12 5:39 AM, John Kearney wrote:
>
>> Bash Version: 4.2
>> Patch Level: 10
>> Release Status: release
>>
>> Description:
>> Current u32toutf8 only encode values below 0xffff correctly.
>> wchar_t can be ambiguous size better in my opinion to use
>> unsigned long, or uint32_t, or something clearer.
>
> Thanks for the patch. It's good to have a complete implementation,
> though as a practical matter you won't see UTF-8 characters longer
> than four bytes. I agree with you about the unsigned 32-bit int
> type; wchar_t is signed, even if it's 32 bits, on several systems
> I use.
Not only can wchar_t can be either signed or unsigned, you also have to
worry about platforms where it is only 16 bits, such as cygwin; on the
other hand, wint_t is always 32 bits, but you still have the issue that
it can be either signed or unsigned.
--
Eric Blake eblake@redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc Description: OpenPGP digital signature