Denis Kulagin
Denis Kulagin

Reputation: 8906

PHP: how to convert mb string to its UTF escape sequence

I would like to convert a mb string to UTF escape sequence.

Hello

to

\u0048\u0065\u006c\u006c\u006f

How to do such a thing?

Upvotes: 2

Views: 67

Answers (1)

Naumov
Naumov

Reputation: 1167

use json_encode("русский") and you get "\u0440\u0443\u0441\u0441\u043a\u0438\u0439" for English not requer encode to utf-8 escaped string. Для русского обязательно.

Upvotes: 1

Related Questions