Chunki Jun @ Modern PUG
mb_*
utf8mb4
mb_http_output(), ...
substr() ➨ mb_substr()
strpos() ➨ mb_strpos()
strlen() ➨ mb_strlen()
But, Not all of them!
http://php.net/ref.mbstringat script
mb_internal_encoding("UTF-8");
But, mb_internal_encoding() uses PHP settings:
at functions
// example at http://php.net/function.htmlentities
echo htmlentities($str, ENT_QUOTES | ENT_IGNORE, "UTF-8");
But, functions use default_charset
string htmlentities ( string $string
[, int $flags = ENT_COMPAT | ENT_HTML401
[, string $encoding = ini_get("default_charset")
[, bool $double_encode = true ]]] )
Use utf8mb4 (MySQL >= 5.5.3)
the utf8mb4 character set uses a maximum of four bytes per character supports supplemental characters
Plane | Detail | Result |
---|---|---|
BMP | Basic Multilingual Plane | utf8 == utf8mb4 |
SMP | Supplementary Multilingual Plane | utf8 != utf8mb4 |
mb_http_output('UTF-8');
No need if file saved w/ UTF-8
UTF-8 in PHP sucks is just fine.