01-04-2010
5.4

i18n

Updated by Robin Vanspauwen on Apr 7, 2010 / Category: Programming / Comments: (3) / Bookmark or Share

Yeah, this is a website built from scratch. So there are some bugs here and there, thanks Jan! for pointing that out...

Maybe a good tip for everyone building a website, do the "Itrntinliztin" test. I found an excellent website that explains and solves these character sets and character encoding issues: http://www.phpwact.org/php/i18n/ charsets. Here's another excellent and comprehensive website about unicode: http://www.joelonsoft ware.com/articles/Unicode.html.

I've some problems with double encoding the information on my website. What is the best way to store and retrieve information from the database? Can somebody help me? This is what I've done so far:

  1. Added some HTML code: <?xml version="1.0" encoding="UTF-8"?> and <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
  2. Added some PHP code: header('Content-Type: text/html; charset=utf-8');
  3. Stored all the POST information without any encoding.
  4. What should I do next? I want to escape all html tags and I want to encode everything in UTF-8. I think that using the php function htmlentities($my_var, ENT_QUOTES, "UTF-8"); isn't good. But when do you have to use this function? Can somebody help me?!

Other questions, suggestions or comments? Please let me know!

Oct 23, 2018 Oct 23, 2018 | said...

Apr  7, 2010 Apr 7, 2010 | Hawkeye said...

No problem Blunt Jan! Thanks for all the advice, this website is here for me to keep up my programming skills...

Apr  2, 2010 Apr 2, 2010 | Kiff said...

Jan!? Blunt? Who would've thought that!

Apr  2, 2010 Apr 2, 2010 | Jan! said...

Sorry for being so blunt, though. :-)