N
N
Nizitka2014-07-03 13:03:20
PHP
Nizitka, 2014-07-03 13:03:20

Why is the site in utf-8, but letters come in windows-1251?

The page of the site, on which the form for sending text in utf-8. The text of the letter comes to the mail (local OpenServera) in the form "Name: R'PIRµRґРёС‚Рµ СЃРІРѕРµ РёРјСЏ.." That is, the part that is formed by the PHP code arrives normally, and the part that is taken from the form is corrupted.
Moreover, if you set the page encoding to ANSI or windows-1251, then the entire page turns into crocodile characters, and letters arrive in their normal form.
How to be?
ps. Perhaps I came across the right solutions, but I'm already confused and stupid.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
O
Oleg Krasnov, 2014-07-03
@Nizitka

Write the encoding in the header of the letter:

$headers = "Content-type: text/html; charset=utf-8\r\n";

E
Evgeny Komarov, 2014-07-03
@maNULL

check the encoding. UTF-8 must be specified on the page and files must also be in utf-8.

N
Nikita Ryabin, 2014-07-03
@nick977

The encoding is written in the form handler file.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question