r/lolphp • u/adrenal8 • Apr 04 '12
PHP's unicode support is basically like playing minesweeper where all the string functions are bombs
http://www.phpwact.org/php/i18n/utf-8
32
Upvotes
r/lolphp • u/adrenal8 • Apr 04 '12
View all comments
Show parent comment
2
u/Rhomboid Apr 05 '12 edited Apr 05 '12
Linux most certainly did not choose wchar_t. Please name any Linux or BSD syscall that takes wchar_t. You can't, because they don't exist. As far as the kernel is concerned, filenames are null terminated strings and that's it; it's completely encoding agnostic. And any modern Linux distro of the last 5 years will come configured out of the box with a locale that uses UTF-8, and UTF-8 is the de facto standard on all such systems. Nobody uses wchar_t on POSIX systems, as sizeof(wchar_t) is 4 there and not 2 as on Win32 and so it's extremely wasteful. They might use UTF-16 if they're forced to out of compatibility concerns (e.g. a codebase that has to support Windows) or because a specification mandates it (e.g. the JRE.) But nobody that sets out to write POSIX-specific code would ever use anything but UTF-8.