V
V
Vitaly Komlev2011-11-02 14:53:53
PHP
Vitaly Komlev, 2011-11-02 14:53:53

Handling Unicode Sequence in PHP

Working with Google.Translate, I encountered the following problem: in response to a request like translate.google.ru/translate_a/t?client=x&text={TEXT}&sl={LANG_FROM}&tl={LANG_TO } (thanks to comrade) the service issues a message containing the following string: "\u0421\u0402\u0421\u0453\u0421\u0403\u0421\u0403\u0420\u0454\u0420\u0435\u0420\u2116".

How can you get ordinary characters from this string using PHP, in particular, this string should be in the form of "Russian"?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
H
ha2bj, 2011-11-02
@ha2bj

Why not run it through json_decode?

A
Anatoly, 2011-11-02
@taliban

I didn't check, but I did two things:
1. www.google.com.ua/search?client=opera&rls=en&q=php+decode+unicode+like+%5Cu&sourceid=opera&ie=utf-8&oe=utf-8
2. clicked on first link: stackoverflow.com/questions/2934563/how-to-decode-unicode-escape-sequences-like-u00ed-to-proper-utf-8-encoded-cha
But judging by the answer: "Thanks a lot, works perfectly !:)" should work

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question