UTF-8 aware String functions
mockey opened this issue · comments
Another thing that bothered me quite often is that the string functions in the old std lib are not utf8-aware (in contrary to other targets). From what I've read UTF-8 is more or less the default now in PHP (have to check this) Maybe it would be good to use mbstring and the like in std lib?
This is a good idea. The only issue is that mbstring
is not installed with php by default: http://php.net/manual/en/mbstring.installation.php So we need to decide carefully.
However i've never seen any hosting or production server without this extension enabled.
Also multibyte functions are 10-20 times slower depending on string length.
So i guess we should go with normal string functions by default.
Maybe introducing a compiler flag to switch between mb/normal string is an option
I thought that something has changed in this regard for PHP7, but actually it hasn't. Unicode support was planned for PHP6 but apparently has been dropped altogether.
So probably leave it as it is with standard string functions in String and some mb_ versions in haxe.Utf8.