I
I
IFK2014-07-24 11:43:30
PHP
IFK, 2014-07-24 11:43:30

How to decode a character like "\u0432" in php?

Given:
MySQL database in utf8 encoding
Table in utf8 encoding
Page with results output in utf8 encoding
When accessing the database, I set the following parameters:

mysql_query("SET NAMES 'utf8'");  
mysql_query("SET CHARACTER SET 'utf8'");
mysql_query("SET SESSION collation_connection = 'utf8_general_ci'");

Question:
When I select the word "out", I get this "\u0432\u044b\u0445".
Why is this and how can this be translated into a readable form in PHP?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
I
IFK, 2014-07-24
@IFK

I figured it out, I processed the output array with the json_encode function, it ruined all the Russian characters. Although the locale is ru_RU.UTF8

D
Dmitry Entelis, 2014-07-24
@DmitriyEntelis

Do you have the page exactly in utf-8? :)
Look, maybe other titles are given somewhere

D
deleted, 2014-07-24
@zayac_agito

Well, since everything is so, then check the script file for belonging to utf-8
Check the application config
Mysql connection config
At the very least, php and mysql configs directly

A
Alexander Borisovich, 2014-07-24
@Alexufo

Not spoiled, but coded.
Do you have the "out" coded there?
unicode-table.com/ru/#0432
utf8_decode should help, but something is not right with you. Everything should work like this...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question