Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem with cyrillic characters in friendly url

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! :(

like image 265
Windom Earle Avatar asked Sep 01 '25 22:09

Windom Earle


1 Answers

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.

like image 75
Quentin Avatar answered Sep 03 '25 20:09

Quentin