[U-Boot] [PATCH v2 2/5] lib: add some utf16 handling helpers

Alexander Graf
2017-09-11T14:41:19Z

On 11.09.17 16:34, Rob Clark wrote:
> On Mon, Sep 11, 2017 at 10:13 AM, Alexander Graf <agraf@suse.de> wrote:
>>
>>
>> On 09.09.17 12:47, Rob Clark wrote:
>>>
>>> We'll eventually want these in a few places in efi_loader, and also
>>> vsprintf.
>>>
>>> Signed-off-by: Rob Clark <robdclark@gmail.com>
>>
>>
>> UEFI wants UCS-2 (the 16 bit only Windows thing), not UTF16 (the
>> may-also-be-32bit-wide thing).
>>
>> So I'm not sure how far away this code is from the ultimate truth of what we
>> need for UEFI compatibility. Do you have any gut feeling?
>>
>
> + leif & peter
>
> I'm not entirely sure. Grub seems to treat it as UTF-16, and from a
> 30sec look at wikipedia, it seems like UCS-2 is a subset of UTF-16.
> But I won't claim to be a unicode expert.

I agree, but we should make sure to have our naming straight. If we only
support the BMP (basic multiplingual plane) part of UTF-16, we should

a) Indicate that in the function names
b) Bark if we get input that's outside the range?

Otherwise sooner or later people will get confused, as UTF-16 strings
can for example be shorter than the sum of 16-bit-fields they occupy.

Alex