There is a php code that displays the identifier from the database, name, last name, position. The encoding in the muscle id is not; name, surname, position - utf-8 ;. In the php page itself, the utf-8 encoding, Displays the id in the browser as needed, and the rest of the hieroglyphs, changing the encoding in the browser to utf-8 (Standardly in the browser for some reason, windows-1251), Everything is fine, but Id in hieroglyphs. How to do right?

  • Do you use any functions to format text before displaying it in a browser? - AseN
  • Made mysql_query ('SET NAMES utf8'); After connecting to the database, it helped, thanks. - angers777

3 answers 3

what in the previous answer and in .htaccess add the line

AddDefaultCharset utf-8 

should help

well and from the previous answer: in the html file or php

 <meta charset="UTF-8"> 

when connecting the database

 mysql_query('SET NAMES utf8'); 

    There is such a garbage that you prescribe <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> , and the browser still renders in 1251 so that this does not happen to me from php additionally send header

     header('Content-Type: text/html; charset=utf-8'); 

    It apparently has a higher priority than specifying the encoding in the markup.

    Well, the ID should still have a number format.

    And another thing, the page with scripts itself should also be saved in utf-8

    • Well, in order not to send the header explicitly, you can also specify in the .htaccess AddDefaultCharset utf-8 and the encoding of all pages will clearly indicate the encoding - varz62

    Try to do:

     mysql_query('SET NAMES utf8'); 
    • html <meta charset = "UTF-8"> mysql SET character_set_results = utf8 SET character_set_client = utf8 SET character_set_connection = utf8 SET character_set_results = utf8 SET collation_connection = utf8_general_ci - KARTOH