Answer the question
In order to leave comments, you need to log in
How can I correctly display Cyrillic in PHP?
In the function, the input parameter is Russian characters from POST, how can I display them correctly? Tried mb_convert_encoding - doesn't work
Answer the question
In order to leave comments, you need to log in
function str_split_unicode($str, $l = 0) {
if ($l > 0) {
$ret = array();
$len = mb_strlen($str, "UTF-8");
for ($i = 0; $i <= $len; $i += $l) {
$ret[] = mb_substr($str, $i, $l, "UTF-8");
}
return $ret;
}
return preg_split("//u", $str, -1, PREG_SPLIT_NO_EMPTY);
}
If the server is Apache (and most often it is), add the line AddDefaultCharset UTF-8 to .htaccess
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question