-3

In my mysql database i have string with german umlauts (ä, ö, ü).

I query them with php/mysql and when displayed on my website, they show up like this:

I have this html in my website:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

edit: i have changed all collations to utf8_unicode_ci but the problem still persists

clamp
  • 33,000
  • 75
  • 203
  • 299
  • [Handling Unicode Front To Back In A Web App](http://kunststube.net/frontback/) – deceze May 20 '13 at 12:22
  • 1
    How are they encoded in the database? How are you fetching them? How are you building the page? – Wooble May 20 '13 at 12:23
  • @Wooble 1. i dont know, 2. mysql_query("SELECT ...") , 3. handwritten with notepad++ – clamp May 20 '13 at 12:26
  • Step 1: figure out what encoding you're using *everywhere*. – deceze May 20 '13 at 12:27
  • 1
    How did the data get into the database? How do you not know what encoding it's in? You can't just throw random bytes onto a page and claim it's utf-8. – Wooble May 20 '13 at 12:27
  • is it the collation that specifies the encoding in mysql? if so, it is latin1. – clamp May 20 '13 at 12:28
  • @Wooble 1. submitted via a POST-webform and then inserted with sql INSERT. 2. i dont know cause i didnt know where to look for it. – clamp May 20 '13 at 12:39

1 Answers1

1

If you have written html meta tag as charset=UTF-8 and you have set Collation as utf8_unicode_ci character set and its not working then you must use

 mysql_set_charset('utf8');

use this where you have made your connection file, like this:-

    $link = mysql_connect("localhost","root","");
    $db = mysql_select_db('testing');
    mysql_set_charset('utf8');
user1414979
  • 92
  • 4
  • 11