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

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


Martin Pitt [2015-02-18 15:06 +0100]:
> 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 had a look into the official spec
http://www.uefi.org/sites/default/files/resources/UEFI_2.4.pdf

While it defines the encoding of strings in several places, like in
"28.2.6 Strings" (page 1542), it only says that it uses the UCS-2
subset of UTF-16. UCS-2 is defined to be big-endian only, but
wikipedia says that in practice a lot of implementations use
little-endian.

"little-endian" and "big-endian" have no useful hits, and "UTF-16LE"
and "UTF-16BE" have no hits in the document.

On my x86_64 laptop it quite clearly uses little-endian, and the
variables don't seem to have a BOM marker at the start to indicate
endianness.

> So if EFI variables are defined to be UTF16LE always, your patch is
> correct.

So meh -- is this defined at all?

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/8a3493b6/attachment.sig>


More information about the systemd-devel mailing list