I'm having real problems keeping the polish character set working from the database to a html/php page. It looks polish in the database but comes out wrong when i call it. But if i paste the code straight in to the html page i works!?

http://picturebox.n.pl/polish%20test.php

and this is what the DB field is set to
pbf_desc_full text character set utf8 collate utf8_bin,

and this is what the text should look like;

Dramat obyczajowy. Scenariusz oparto częściowo na biografii wielkiej gwiazdy rapu, Eminema, który odtwarza główną rolę - młodego robotnika pracującego w fabryce w Detroit i starającego poprawić swoje życie dzięki udziałowi w rapowych starciach.

any pointer welcome!

    For me it helps to send the following queries after connecting:

    SET CHARACTER SET 'latin2'
    SET NAMES 'latin2'
    

    as I'm working in iso-?????-2. Substitute latin2 with utf8 and see if it works

      mmm - it was already set to utf8_bin and made no differnece.

      are you telling me to set it to latin2 or utf8?

      also how would i implement the SET CHAR...

      like this:

      $sql = mysql_query("SELECT * FROM pbf_films WHERE pbf_id='52' ORDER BY pbf_dd LIMIT 4 SET CHARACTER SET 'latin2' ");

      which doesn't seem to work.

      thanks for your help..! D.

        If your page is in utf-8, change it to utf8_bin. And those two lines have to be send after connecting to the database, not after each query.

        $link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
         if (!$link) {
             die('Could not connect: ' . mysql_error());
         }
         $db_selected = mysql_select_db('foo', $link);
         if (!$db_selected) {
             die  ('Can\'t use foo : ' . mysql_error());
        }
        mysql_query("SET CHARACTER SET 'utf8'; SET NAMES 'utf8'",$link)
        
        //the rest of your queries here
        
         mysql_close($link);
        

          thanks for that - seems to be doing something. the sql change doesn't seem to make a different but the utf8_bin improves the situation but some chars are still '?'.

          Dramat obyczajowy. Scenariusz oparto cz??ciowo na biografii wielkiej gwiazdy rapu, Eminema, który odtwarza g?ówn? rol? - m?odego robotnika pracuj?cego w fabryce w Detroit i staraj?cego poprawi? swoje ?ycie dzi?ki udzia?owi w rapowych starciach.

          should be;

          Dramat obyczajowy. Scenariusz oparto częściowo na biografii wielkiej gwiazdy rapu, Eminema, który odtwarza główną rolę - młodego robotnika pracującego w fabryce w Detroit i starającego poprawić swoje życie dzięki udziałowi w rapowych starciach.

            what is your meta tag in html concernig charset? (and try utf8 not utf8_bin)

              it is;
              <meta http-equiv="Content-Type" content="text/html; charset=utf8_bin" />

              tried a few others i found in the sql options box but can't get better than this. So frustrating as is fine in phpMyAdmin. Also tried it on another server without any issues what so ever. D.

                It should be utf-8 with "-" and without bin for sure in meta tag. I had problems as well when default charset in apache configuration was set to something different then the charset of a page - maybe you should look there.

                  ah f it. still the same. ill move servers me thinks. thanks for your help wilku!

                    Write a Reply...