Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which Unicode encoding does the Linux kernel use?

I have learned that Windows uses UTF-16LE on x86/x64 systems. What about Linux? Which Unicode encoding does it use: UTF-16LE or UTF-32?

like image 844
Jichao Avatar asked Nov 29 '25 05:11

Jichao


2 Answers

http://www.xsquawkbox.net/xpsdk/mediawiki/Unicode says

Linux

On Linux, UTF8 is the 'native' encoding for all strings, and is the format accepted by system routines like fopen().

so Linux is like Plan 9 in that respect, and boost::filesystem and Unicode under Linux and Windows notes

It looks to me like boost::filesystem under Linux does not provide a wide character string in path::native(), despite boost::filesystem::path having been initialized with a wide string.

which would rule out UTF-16 and UTF-32 since all variants of those require wide character support -- NUL bytes allowed inside strings.

like image 100
Mike Samuel Avatar answered Dec 02 '25 02:12

Mike Samuel


Generally Unix prefers UTF-8. This document suggests that Linux kernel does too.

like image 32
MK. Avatar answered Dec 02 '25 02:12

MK.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!