I use UTF-8 on all my pages, but some Swedish characters (å ä and ö) get messed up (just a square box with some letters in). My database is set to utf8_general_ci, but I'm not even connected so that doesn't really matter. Or should I use another charset? It's not a Swedish site, it's all in English but I want å ä and ö to work anyway.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled document</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="default.css" />
</head>
<body>
<p>åäö</p>
</body>
</html>
What's the problem? :/
I use WAMP by the way.
Thanks alot
I know this is old, but I came across the same problem.
I just needed to set the correct charset:
I think the server serving the page is overriding the encoding. Can you please try: Setting charset information in .htaccess.
Works fine for me either double-clicking a file (as long as the editor is utf-8 capable) or serving it from localhost (Apache, defaults to UTF-8).
You should indeed check what HTTP headers your web server is sending along the file. If your previous content is in English (read: ASCII) you may have never had a hint that your server was overriding the infile declaration of UTF-8 with a header saying ISO-8859-1 or Windows-1252.
You may take a look at the headers in realtime with some Firefox extensions like Live HTTP Headers or HTTPFox. If this is the cause of the mishap and your server is Apache just add the line
AddDefaultCharset utf-8
either in the mainl httpd.conf file or a .htaccess file in the webroot folder.This is pretty old but I came across the same problem and I thought I would share the solution. Make sure your text editor is saving the file as utf-8 encoded. It isn't enough to just set the encoding scheme in the meta-data to utf-8.
This is how it works in dreamweaver:
1) Click on Modify on the top panel of the window. 2) Select Page Properties 3) Select Title/Encoding 4) Set the encoding scheme to UTF-8
Hope this helps.
I just want to give my thoughts on this, since it might help others having this problem.
Except setting the Charset on the site, one has to know what charset is used in the editor when creating the page.
I have done the mistake many times to use UTF8 on the webpage, but in Notepad++ (my editor of choice) I use the standard charset which is ANSI, so my å ä and ö gets scrambled...
So if swedish letters is not showing correctly on a UTF8 encoded site, then check the source file so the FILE is encoded with charset UTF8 aswell, then it should work.
I think it is important that your file is encoded in the same way that of which you set your charset in the meta tag. When they differ I think there are problems. So you need to know what your file is encoded to!
If file is encoded utf-8 then use:
If yout file is encoded with ISO-8859 then use:
When I keept them both the same, the encoding of file and charset in meta-tag it worked. Good luck!