A
A
Anton2016-10-31 16:09:32
PHP
Anton, 2016-10-31 16:09:32

How to get normal text?

Hello. I have the following text: \u041a\u0430\u0440\u0442\u043e\u0447\u043d\u044b\u0435 \u0432\u043e\u0439\u043d\u044b. \u0424\u0438\u043d\u043 how to get normal text from it?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
X
xmoonlight, 2016-10-31
Reytarovsky @Antonchik

1. json_decode()
2.

html_entity_decode(str_replace('\u','&#x',$str), ENT_NOQUOTES,'UTF-8');

Алексей, 2016-10-31
@masterfreelance

$str='\u0412\u0440\u0435\u043c\u044f\u043f\u0440\u0438';
$ar=explode('\u',$str);
for($i=1;$i<count($ar);++$i) {
    $n.='&#'.base_convert($ar[$i],16,10);
}
echo html_entity_decode($n, ENT_NOQUOTES,'UTF-8');

V
Victor, 2017-01-05
@v_decadence

I didn’t fully understand, but I think the error is that find returns null if there is no such id in the database, which gives an error when trying to access the null property.
As an option: check product through is_null.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question