Problem with cyrillic characters in friendly url

todoroff picture todoroff · Feb 7, 2011 · Viewed 9.6k times · Source

Here's the thing. I have friendly urls like

http://site.com/blog/read/мъдростта-на-вековете

http://site.com/blog/read/green-apple

The last segment is actually the friendly title of the blog article. The problem is when I try to pass that segment to the database, the cyrillic fonts turn into something like %D1%8A%D0%B4%D1%80%D0%BE%D1%81%D1%8 and couldn't match the database record. In the address bar in my browser it looks normal (мъдростта-на-вековете) but if I choose 'copy url location' the last segment again turns into these strange characters. I'm using CodeIgniter and everything is set to UTF-8.

Please help! :(

Answer

Quentin picture Quentin · Feb 7, 2011

The text is just being encoded to fit the specification for URLs.

Echo out the data to a log to see what you are actually trying to pass to the database.

You should be able to decode it with urldecode.