Answer the question
In order to leave comments, you need to log in
How to make PHP and MySQL encodings compatible?
The essence of the problem is this: when pulling words from SQL into PHP, the words themselves are understood by PHP normally, but individual letters turn into scribbles:
// === Здесь идут запросы ===
$word = mysql_fetch_array($result);
echo $word; // Выведется, к примеру "бороды"
echo $word[1]; // Выведется "�"
Answer the question
In order to leave comments, you need to log in
The problem is that you don't understand that utf8 is a multi-byte encoding, and the letters of utf8 strings in php cannot be accessed via a serial number.
If you need the second letter it should be like this:
$word = 'борода';
echo $word[2].$word[3];
echo mb_substr($word, 1, 1, "UTF-8");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question