The page should be in utf-8, but when it does not work in utf-8, the php script at the beginning of the page does not work, and when it does not work in utf-8 without bom, then the script works, but there is no Russian language, what can I do? <? php session_start ();

include ("bd.php"); if (isset($_GET['id'])) {$id =$_GET['id']; } else { exit("121!");} if (!preg_match("|^[\d]+$|", $id)) { exit("<p>ифв URL</p>"); } if (!empty($_SESSION['email']) and !empty($_SESSION['password'])) { $email = $_SESSION['email']; $password = $_SESSION['password']; $result2 = mysql_query("SELECT id FROM users WHERE email='$email' AND password='$password'",$db); $myrow2 = mysql_fetch_array($result2); if (empty($myrow2['id'])) { exit("bad id!"); } } else { exit("122"); } $result = mysql_query("SELECT * FROM users WHERE id='$id'",$db); $myrow = mysql_fetch_array($result); if (empty($myrow['email'])) { exit("123");} ?> 
  • 2
    What editor do you use? - atnartur

2 answers 2

In .htaccess add the line:

 addDefaultCharset utf-8 

    This effect appears depending on the editor. There are several solutions:

    1. Create a new file with the desired encoding, and paste the desired code.
    2. Convert the file to yutf-8, delete the very first invisible character, to do this, put the cursor at the beginning of the line and click "delete"
    3. Use another editor.