I have a strange problem with some documents on my webpage.

My data is stored in a MYSQL Database, UTF8 encoded. If read the values my webbpage displays

Rezept : Gem�se mal anders (Gem�selaibchen)

I need ü / ü!

Content in the database is "Gemüse ... " ..

The raw data in my error_log looks like this

[title] => Rezept : Gemüse mal anders (Gemüselaibchen)

The webpage header is:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<!--[if IE]>
  <link rel="stylesheet" href="http://www.dev-twitter-gewitter.com/css//blueprint/ie.css" 
        type="text/css" media="screen, projection">

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


To all answerers: In the original question only the DOCTYPE was visible because of misformatting of the code. I fixed it. All the other stuff was there in the original question!

Written by DR

The meta tag looks reversed.

Written by UncleO

Accepted Answer

MySQL needs to know you want the output as UTF-8 - it's likely configured to send as latin1, so your browser sees the invalid UTF-8 byte sequences and outputs the "not a character" glyph.

Send the query "SET NAMES utf8" immediately after opening the MySQL connection, or change the configuration (if possible).

Written by Michael Madsen
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki