URL utf8

Note about URL and UTF-8 :

  • There is a Firefox option (about:config) network.standard-url.encode-utf8 that you have to activate in order to comply to the standard (see http://kb.mozillazine.org/Network.standard-url.encode-utf8) So you can type in an URL with é and it will be converted to %C3%A9 wich is the expected stardard behaviour.
  • According to RFC 3987, URLs must be converted to UTF-8 character encoding. IE and Opera, contrary to the specification, encode the path part of the URL in UTF-8 but encode the query string part of the URL in the encoding of the referring page ! That would be right for POST parameter, but not for GET !!!
  • W3C make it clear too that URL should be encoded in UTF-8 http://www.w3.org/International/O-URL-code.html (has some Java example code).
  • In PHP you should use :
    urlencode(utf8_encode('großpösna'))  -> gro%C3%9Fp%C3%B6sna : GOOD
    utf8_decode(urldecode('gro%C3%9Fp%C3%B6sna')); -> großpösna : GOOD

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: