[SOLVED] How to use international characters in URL's? |
[eluser]t'mo[/eluser]
This one's got me stumped. I'm trying to make my app play nice w/my non-American friends; after all, it's been 7 years since Joel ranted at us web developers for not knowing about proper use of Unicode (http://www.joelonsoftware.com/articles/Unicode.html). I want to make URL's that have part of my users' names, e.g., http://www.yoyocase.net/yoyos/Nolsøe Unfortunately, hitting that URL in my browser gives me the "Disallowed Key Characters" error, though a search of the forums led me to believe that the error only applied to cookie keys. (I suppose it could be from using QUERY_STRING in $config['uri_protocol'].) Any ideas?
[eluser]t'mo[/eluser]
Update: I'm making some progress, but not all the way there yet. Here are my best guesses at what's relevant in my configuration: Code: // (from system/application/config/config.php) Code: # from .htaccess Note: this is a step up from where I was yesterday, in that it's at least getting to my Controller instead of dying in the Input class validation and exiting with the message "Disallowed Key Characters". Note 2: yes, to complicate matters, the site is currently hosted on GoDaddy.
[eluser]t'mo[/eluser]
In addition to the changes listed in the previous post (i.e., using REQUEST_URI instead of QUERY_STRING), and with the following changes, it's now working. Code: // ...in my Controller class... --- So, with that now fixed, here's what I've learned: 1) Setup the database to accept int'l characters (UTF-8 in my case); note that MySQL by default will use Latin-1, unless you tell it otherwise; note also that MySQL allows you* to specify this at a database level, table level, or column level. 2) Be sure to specify an in-page Content-Type on each HTML page/template: Code: <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 3. Always keep in mind the types/levels of encoding (UTF-8 at a character-set level vs. URL encoding just for HTTP) and when each should be used. --- * I'm not so sure you can specify character-encoding at the database level if it's on a shared host; however, don't forget you can specify the lower-level objects. |
Welcome Guest, Not a member yet? Register Sign In |