Maintaining Proper Character Set Encoding in UTF-8

  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8416
  • Loc: USA

Post 3+ Months Ago

I am trying to encode my site to UTF-8, due to someone's implied suggestion :lol:

What I am attempting right now is:
Code: [ Select ]
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />

The problem with that is that it doesn't work... when I try • I get either � or ? or simply a square...

What is/are the technique(s) to encode a file to any charset properly?

Thanks
  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13504
  • Loc: Florida

Post 3+ Months Ago

You need to know the present character set, the character set you want to use, something to convert the characters between the two sets, and a plan for dealing with any characters that don't have straight conversions.

Simply adding that <meta> element, or a character set hint to the Content-Type HTTP header is like putting water in a gas can and expecting that to make the water flamable. :)
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8416
  • Loc: USA

Post 3+ Months Ago

So... how do I do that? Is there a tutorial out there that would teach me how to do that? I googled and couldn't really find anything that really helps... all they do is give me the META element or the <?XML > element and the ini_set() thing or the .htaccess equivalent... but no were do they speak above converting between two sets...
  • jammer2552
  • Graduate
  • Graduate
  • User avatar
  • Posts: 139

Post 3+ Months Ago

Keep the file ANSI (Notepad default), but use HTML entities for special symbols that you have to use the ALT+### convention.

For example:

Turn "MySite - MyPage" into "MySite - MyPage"
  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Posts: 6254
  • Loc: Seattle, WA

Post 3+ Months Ago

Attachments:
utf8.png
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8416
  • Loc: USA

Post 3+ Months Ago

Ha! lol. I didn't see that :lol:

Thanks spork
  • effim
  • Beginner
  • Beginner
  • User avatar
  • Posts: 35
  • Loc: Austin, TX

Post 3+ Months Ago

Maintaining proper character set encoding can be a headache at first, but it's not too complicated. The principles are....

1) Make sure content is created in the desired character encoding by informing the software what character set to use.

2) Whenever the content is stored or transferred, make sure that any software that will be manipulating or reading the data is aware of the character encoding. Remember, MySQL and other databases are character-encoding-aware but typically default to encodings other than UTF-8.

3) When you display your content on a website, send both a content-encoding header and the meta tag for the content encoding. Make sure that they match, and put your meta tag above your title tag so that the browser doesn't need to re-parse it if it's interpreting the page as a different character encoding.
  • Bogey
  • Genius
  • Genius
  • Bogey
  • Posts: 8416
  • Loc: USA

Post 3+ Months Ago

Thanks effim... I had all that done except the meta tag above the title tag... now it is (On my local server as of now... will upload it to my domain when I'm done with the content... I will update my whole site with this thing and remove what I have now...

Thanks :)

Post Information

  • Total Posts in this topic: 8 posts
  • Users browsing this forum: No registered users and 22 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.