[systemd-devel] [PATCH] shared: fix utf16_to_utf8() on big endian machines

Martin Pitt martin.pitt at ubuntu.com
Wed Feb 18 06:06:08 PST 2015


Hey Tom,

Tom Gundersen [2015-02-18 14:34 +0100]:
> I think we want to assume that we only get UTF-16LE, so it looks like
> it is the test that is buggy. That's what we agreed, right Lennart?

Ah, ok. Indeed GUID partition names are UTF16LE.

I couldn't quickly find a reference for EFI variables (which is the
main thing we are using this for), and I don't have/know a big-endian
EFI machine to check this on. I found

 http://uefi.blogspot.de/2009/12/uefi-hii-part-7-character-encoding.html

which raises the endianness question (but doesn't answer it), and
https://en.wikipedia.org/wiki/UTF-16 says both LE and BE are possible.

> How about the attached patch?

Confirmed to work on powerpc (BE) and x86_64 (LE). So if EFI variables
are defined to be UTF16LE always, your patch is correct.

Thanks!

Martin

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150218/c62a4127/attachment.sig>


More information about the systemd-devel mailing list