Caleb Doucet
Caleb Doucet

Reputation: 1781

French accents in meta tag's content

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 &agrave; Qu&eacute;bec r&eacute;f&eacute;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

Answers (5)

becknr
becknr

Reputation: 66

if you want to be updated, in html5 you must use this

<meta charset="UTF-8">

for french accent ;)

Upvotes: 1

virenpatel111
virenpatel111

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

Denys S&#233;guret
Denys S&#233;guret

Reputation: 382102

Either your document isn't properly encoded or it has a bad header.

I suggest :

  • you check your editor makes UTF-8 (without BOM) documents
  • your headers in the HTML file : you should have <meta charset="UTF8" />
  • the configuration of your server if first two points aren't enough

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

Sed
Sed

Reputation: 6381

You need to encode the file in the right form, download notepad++ and switch to the correct encoding for french.

Upvotes: 2

poudigne
poudigne

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

Related Questions