Greetings to all!

I use this construction:

$.getJSON("http://test2.ru/adminbook/getBook.php?time=" + Math.round(new Date().getTime()) + "&callback=?", function (data) { //alert(data.length); alert(data[0].title); }); 

The data comes in the form of hieroglyphs (letters on top with all sorts of tildes). All files in utf-8, bd in utf-8, header are utf-8.

    1 answer 1

    And you try psychonut and in .htaccess to add a line:

     AddDefaultCharset UTF-8 

    Plus, after connecting to the database, make such a request:

     mysql_query('SET NAMES "utf8"'); 
    • .htaccess - here will not work. And in the Apache configs is UTF-8. added after connecting: $ r = $ db-> query ('SET NAMES "utf8"'); $ r-> execute (); Now new kryakozyabry - V_Tjuryakin
    • @Deonis, why utf8 in separate quotes? - Oleg Arkhipov
    • one
      @Construct, quotes, in general, are not required. Just a habit of passing parameters to take in quotes. @V_Tjuryakin, then a method that I don’t really like, but as an option - transcode using iconv () PS By the way, I remember once there was a similar problem. In the file handler hung header ("Content-type: text / html; charset = windows-1251"); If memory serves, it helped - Deonis