Reputation: 1781
I have french accents in a meta tag's content section. Example:
<meta name="description" content="à Québec référence" />
When I look at the page source I get:
<meta name="description" content="à Québec référence" />
I've tried using à Québec référence
but that's how it is displayed in the content section.
I am using
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1" />
and I don't think this can change without messing up thousands of characters elsewhere in my project.
How do I get it to look like the first example, is there a php function to use? Thanks.
Also an explanation of why it gets translate to 'à Québec référence' would be nice.
UPDATE
I've figured out a solution. Programs like Aptana Studio and Notepad++ were saving the characters in a strange way. I used notepad to edit it and saved it with that and that seemed to solve the problem. Thanks for all your quick responses. Much appreciated. :)
Upvotes: 1
Views: 3870
Reputation: 66
if you want to be updated, in html5 you must use this
<meta charset="UTF-8">
for french accent ;)
Upvotes: 1
Reputation: 201
If content comes from mysql database. Use utf 8 connection by querying "SET NAMES 'utf8'"
Sometime it happens because of editor's file encoding which is suppose to be UTF-8.
Upvotes: 0
Reputation: 382102
Either your document isn't properly encoded or it has a bad header.
I suggest :
<meta charset="UTF8" />
Here's the w3.org tutorial on this topic.
If you really can't change the charset, ensure the charset specified in the meta
tag is the one of the file. In the short term having this in your header might solve your problem :
<meta charset="ISO-8859-1" />
Upvotes: 1
Reputation: 6381
You need to encode the file in the right form, download notepad++ and switch to the correct encoding for french.
Upvotes: 2
Reputation: 1766
Put
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
between your HEAD tag You can also use 'iconv' under linux to change file encoding. (recommended)
Upvotes: 5