UTF-8 helpers of _class('utf8') (class yf_utf8). PHP's mb_* functions cover most needs; these
two are for byte limits and old encodings. All methods: API reference / yf_utf8.
truncate_bytes
truncate_bytes($string, $len): the string cut to at most $len bytes without splitting a character (a cut
inside a multi-byte sequence moves back to its start). For a column measured in bytes; to cut by characters use
mb_substr().
Result
При_class('utf8')->truncate_bytes('Привіт, світ', 7)convert_to_utf8
convert_to_utf8($data, $encoding): text of another encoding as UTF-8 (iconv, recode or mbstring), or false.
Result
Привіт_class('utf8')->convert_to_utf8(mb_convert_encoding('Привіт', 'Windows-1251', 'UTF-8'), 'Windows-1251')unicode_check
unicode_check(): checks the Unicode support of PHP (mbstring) and sets its UTF-8 defaults; the framework calls it at
start, sites do not need to.