K
K
Kirill Sapronov2016-09-09 12:38:39
PHP
Kirill Sapronov, 2016-09-09 12:38:39

How to put correct php encoding?

Hello, please tell me how to set the encoding when writing a php file with a script. The script itself is in utf-8, the file from which the script draws utf-8 information, when creating a .txt file from the script, it is created in the Mac encoding. When changing it to utf-8 and then overwriting the file from the script, the system swears that The UTF-8 file “href.php” is damaged or incorrectly formed; please proceed with caution. (the .php extension is just for example, .txt says the same but doesn't open). Googled a lot, nothing helps, I no longer know how to solve this seemingly not very difficult problem. I tried to encode in utf-8 the variable itself, which is written to the file - it gets even worse. Also, when I load a line from a file, for example, "Metro Novogireevo" - the last "o" becomes a rhombus with a question mark,
In general, please help, I broke my whole head
. In general, for some reason, I have an eternal problem with these encodings, that in other programming languages, that when accessing the database ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2016-09-09
@slo_nik

Good afternoon.
What is the server encoding?
Bring everything to one encoding and you will be happy)))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question