There was a problem with the encoding or, damn it, understand with what.

Here is the code:

<?php header('Content-Type: text/html; charset=utf-8'); $user = $_GET['nick']; $settings = $_GET['settin']; $tes = str_replace("\q", "\n", $settings); file_put_contents($user.'.ini', $tes); ?> 

He receives information in Cyrillic and creates a file, in echo everything is fine, but question marks appear in the ini file it creates.

What to do? Help me please.

    1 answer 1

    file_put_contents binary safe. This means that exactly what is said will be written to the file.

    Accordingly, questions to the program, which you then try to read this file. Cyrillic has a lot of different encodings and it is necessary to display data from a file strictly in the encoding in which the data was recorded.