K
K
Kirill2015-10-18 22:07:12
PHP
Kirill, 2015-10-18 22:07:12

The problem with json_encode outputs Latin, Russian characters are not?! How to be?

Guys, I've been sitting for several hours, breaking my head, I don't know what to do!
The essence of the problem is this - I make a request to the database, the answer is returned to me is there an email in the database or not.
I give this whole thing with the help of json_encode in JS, in order to write beautifully to the user - alas, dude, email is already registered like that.
Actually, this json_encode looks like this

echo json_encode(
            array('st_email' => 0,
                'email' => 'Данный email уже зарегистрирован в системе!'
            ), JSON_UNESCAPED_UNICODE
        );

Even JSON_UNESCAPED_UNICODE doesn't help either! I don’t get any data with Cyrillic at all, if I write instead of Given email ... - Latin or numbers - everything works fine! What kind of hat can be guys? Please help, my head is already really hurting, I have been dripping this thing for about 2.5 hours!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kirill, 2015-10-18
@Lobanov

Before doing anything - look at the encoding of your file!))) It must be in UTF-8!! This turned out to be evil in my case, a simple oversight and not attentiveness!)))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question