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"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<!--[if IE]>
<link rel="stylesheet" href="http://www.dev-twitter-gewitter.com/css//blueprint/ie.css"
type="text/css" media="screen, projection">
<![endif]-->
<meta name="text/html; charset=UTF-8" content="Content-Type" />
You have to set the encoding of your web page.
There are three ways to set the encoding:
HTML/XHTML: Use a HTTP header:
Content-Type: text/html; charset=UTF-8
HTML: Use a meta element: (Also possible for XHTML, but somewhat unusually)
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
XHTML only: Set the encoding in the preamble: (Preferred for XHTML)
<?xml version="1.0" encoding="UTF-8"?>
If you want to verify the problem first:
First change the encoding manually using your browser. If that works you can set it in your HTML file. Make sure you reset the manual encoding to automatic detection, otherwise it'll work on your workstation, but not on your users' workstations!
A PHP speciality: Make sure your internal encoding is set to UTF-8, too! All outputs are converted to this encoding.
You can enforce the internal encoding using mb_internal_encoding
at the top of every file.
After all: All this doesn't help if your code isn't actually UTF-8 encoded! If it is, check if there are any helper functions which might destroy the UTF-8 encoding.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With