After transferring the site to another hosting, there was a problem with the regulars (before that there were no such problems, so this is the ratio of the event with hosting). In short, there is a regular `

$country = preg_replace('/[^А-Яа-яA-Za-z ]/', '', $_POST['country']); 

For example, if the country "Russia" is entered, then it is written into the database as Russia, similarly with other countries, and the letters are each differently replaced with "?". If you write a regular season this way, everything is displayed normally: `

 $country = preg_replace('/[^АБВГДЕЁЖЗИКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзиклмнопрстуфхцчшщъыьэюя]/', '', $_POST['country']); 

What is the problem?

  • O_o thanks, helped - xenon

2 answers 2

Try the u modifier for a regular expression.

    question marks in black diamonds? If yes then problems in coding

    • no, that's the point, they used to be in diamonds, re-saved the file with UTF-8 encoding without BOM, everything was fine - xenon
    • $ country = preg_replace ('/ [^ A-Ya-Ya-A-Za-z] / u', '', $ _POST ['country']); Try with the parameter / u php.net/manual/ru/reference.pcre.pattern.modifiers.php - binliz