3

I've got the following problem with my PMA-GUI:

While the data submitted by PHP-Scripts to my database is displayed correctly, ONLY PMA displays several german Umlaut's (such as äüß, ..) as ü or ä

The problem occurs also while exporting tables to file..

MySQL: 5.0.51a-3ubuntu5.8
PMA: 3.4.5
Database & fields are utf8_general_ci

Does anybody know a solution?

BenMorel
  • 34,448
  • 50
  • 182
  • 322
Micronax
  • 660
  • 13
  • 25

2 Answers2

2

You need to ensure you use consistent use of character set/character encoding.

For example, to normalise to UTF-8 content, your DB fields' character sets should be set to UTF-8. Then, in your PHP (if you have your own scripts running that fetch DB information) you need to then add to the head section:

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

Then, in the PHP, before any output to the browser, include the content type PHP header:

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

Before you run any SQL to fetch content (so after you connect, but before executing your query), use mysql_set_charset:

mysql_set_charset('utf8',$link); 
// $link is optional, refers to your DB connection

You can think of it as three steps:

  1. The step used to add the characters to your DB
  2. Storage of characters in your DB
  3. Retrieval and display of characters

The simplest bet to ensure conformity and that characters display as you anticipate, is to ensure the correct, consistant, character set is defined at each stage.

SW4
  • 69,876
  • 20
  • 132
  • 137
  • In MY own Web-Interface the data is shown corrently. Only the PMA-Interface seems to have problems with the charakter encoding.. – Micronax Oct 10 '11 at 12:54
  • have you tried implementing: mysql_set_charset('utf8',$link); ? – SW4 Oct 10 '11 at 12:56
2

Are you sure that your client is sending data as utf-8?

this seems to me a duplicate of:

German Umlaute in Mysql/Phpmyadmin

Community
  • 1
  • 1
Gianpaolo Di Nino
  • 1,139
  • 5
  • 17
  • The thing is: When i output the table contents using PHP in my Frontend, everything's okay & encoded correctly.. – Micronax Oct 10 '11 at 13:01
  • as explained in the link it is normal because your client is encoding & decoding by itself the data for you. Try using, as ErgoSummary explained to you, mysql_set_charset just after you setup the connection and before doing any queries.. Take a look on the link, everything is explained there and i don't want to duplicate the answer. – Gianpaolo Di Nino Oct 10 '11 at 13:04
  • Okay - You were finally right! Is there an automativ way to convert these annoying symbols back to my Umlauts? – Micronax Oct 10 '11 at 13:18
  • 1
    @MxAgent: that's another question ;) have fun: http://en.gentoo-wiki.com/wiki/Convert_latin1_to_UTF-8_in_MySQL – Gianpaolo Di Nino Oct 10 '11 at 13:27