Jump to content

[SOLVED] HTML Character Encoding


Recommended Posts

I posted a similar thread in the MySQL help forums about character encoding and inconsistencies when inserting into a database, but these are definitely two distinct questions and I think this one belongs here.

 

I've been told that UTF-8 character encoding supports french characters (and that it is generally the most universal encoding that there is).  If that's the case, why don't french characters display correctly with it?

 

See both files here for an example.  They are identical except for their character encoding:

 

http://rawbwk.com/french/

 

Also note the error when trying to validate:

 

Sorry, I am unable to validate this document because on line 11  it contained one or more bytes that I cannot interpret as utf-8  (in other words, the bytes found are not valid values in the specified Character Encoding). Please check both the content of the file and the character encoding indication.

 

The error was: utf8 "\xE2" does not map to Unicode

 

http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Frawbwk.com%2Ffrench%2Futf.html

 

The identical code with an 'ISO-8859-1' encoding validates with no errors.

 

What's the deal?!

Link to comment
https://forums.phpfreaks.com/topic/146799-solved-html-character-encoding/
Share on other sites

There are a few possibilities. First, the characters don't exist in UTF-8. I don't know if this is the case or not, as I'm not that knowledgeable on French charsets. But I do know that UTF-8 isn't always all it's cracked up to be. I program Japanese sites, and its better to use other charsets than UTF8 for them.

 

But lets assume that it may actually be an ok charset to use. There are a few things you can check:

 

1) Are you putting the charset in a meta tag in your header? You should be.

2) Is your document also saved in UTF-8? The document itself has to be saved in the correct charset for it to work. Try saving it in UTF8, then re-validate your document.

2) Is your document also saved in UTF-8? The document itself has to be saved in the correct charset for it to work. Try saving it in UTF8, then re-validate your document.

 

Thanks much for your reply!  I had absolutely no idea that you had to do anything other than put the encoding in a meta tag, but this was the problem!

 

Works like a charm now. :)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.