Hello, I’m suffering so much, but I can’t find a complete answer to this question.

  1. What encoding should be in the database (MySQL, if Russian, Kazakh and English are used), and is it necessary to write the settings in .htacces and what to write exactly?
  2. What is the encoding in the html page and how to write it there for all cases?
  3. In php file?
  4. In php when creating xml files?
  5. Do I need to write the encoding in CSS in JavaScript?

Studying web programming languages ​​is already a year, and everyone, just putting work on the server, is a problem with the language. )

    6 answers 6

    Fully:

    - mysql: specify UTF8 encoding and collation utf8_general_ci everywhere

    - php:

    1) after connecting to the database

    mysql_query('SET NAMES UTF8;'); 

    2) optional add before withdrawing

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

    - ide (editors): check the encoding to be unicode. It is advisable to put it by default.

    - apache: add a line to the .htaccess file

     AddDefaultCharset UTF8 

    - html: add a tag to <head> </ head>

     <meta http-equiv="content-type" content="text/html; charset=utf8" /> 
    • I do not know how much I drive, here's the screen ( saveimg.ru/show-image.php?id=37a44b9ab67095dda9efa339a270bcbb ) doesn’t display everywhere in IE chrome! Denwer is the last, if anything, tell me, I'll make more screenshots or throw off the code itself)) very grateful !!! - Eugene536
    • but it seems to be a problem with Denver, created everything as you said and launched it from the desktop, everything was fine, and when I threw it into the server folder, and launched through localhost / it was scary horrible! - Eugene536

    In css and js do not need to write. Do utf8 everywhere. In php, add after connecting to the database:

     mysql_set_charset('utf8'); 

    In bd table and field utf8. In heder write

     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
    • > In bd table and field utf8. DB And tables in UTF8 :) - ams
    • I put the encoding yutf8, now all the inscriptions have turned into R'S ‹R ± RСSЂRєR ° R” R ° RЅRЅS ‹C ... RyoR · R'R” - Evgeny536
    • type in .htacces: AddDefaultCharset utf-8 - Kenpachi
    • and in Dreamweaver it displays normally all the characters)) - Eugene536

    What browser do you open? Can it be set there forcibly? in the script instead of mysql_set_charset ('utf8'); You can also try
    mysql_query ("set character_set_client = 'utf8'");
    mysql_query ("set character_set_results = 'utf8'");
    mysql_query ("set collation_connection = 'utf8_general_ci'");

    it seems so ... i did for cp1251 exactly like that.

    By the way, I recommend using the PHP Expert Editor (for Russians, registration is free with soap)

      mysql_query ("SET NAMES utf8"); you write this in php files, and Russian and English are provided for you

        if you use utf8 encoding then php encoding, html files should be utf8

          try to open the page, and if there is no correct encoding there .. = test with encoding (by switching it in the browser) in ie this menu> view> encoding. in mozilla fx or ibid. and that's what will go - this and put ..