CodeIgniter Forums
Use utf-8 fonts in url? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Use utf-8 fonts in url? (/showthread.php?tid=1648)



Use utf-8 fonts in url? - rakibtg - 03-29-2015

I can't understand what goes wrong with utf-8 font in url :/ how did you solve this problem?
[Image: N8jPdBS.png] Thanks in advance


RE: Use utf-8 fonts in url? - CroNiX - 03-29-2015

Check your setting for $config['permitted_uri_chars']. The default only allows English letters, numbers and a few others.
https://github.com/bcit-ci/CodeIgniter/blob/develop/application/config/config.php#L156


RE: Use utf-8 fonts in url? - rakibtg - 03-29-2015

In that case it is not possible to add every single characters in that string. what could be another option? this way seems to be black-hat but can we apply a white-hat approach, i am not sure if i am speaking right about black hat or white hat Big Grin but i think you get the point


RE: Use utf-8 fonts in url? - CroNiX - 03-29-2015

You can always leave that config setting blank like the notes say, which will allow all chars. It does open more security risks though. But I believe the proper way would be to urlencode non-ascii chars in the url.


RE: Use utf-8 fonts in url? - rakibtg - 03-29-2015

i think urlencode will also not gonna work, cause latest browsers decode it right in the addressbar :[


RE: Use utf-8 fonts in url? - CroNiX - 03-29-2015

Yeah, but that's how it's supposed to work! The HTTP specs state that urls should only contain ascii characters, or url encoded chars. This isn't a CI limitation. CI is using the STANDARD. Browsers set to use that language will properly decode it in the url and show it properly - others will see the urlencoded string, which is proper.


RE: Use utf-8 fonts in url? - CroNiX - 03-29-2015

You might want to read up on the RFC standard here: https://tools.ietf.org/html/rfc3986#page-11


RE: Use utf-8 fonts in url? - mwhitney - 03-30-2015

The following page details some of the standards and proposals related to handling of multilingual URLs:
http://www.w3.org/International/articles/idn-and-iri/Overview

It also includes details about how some browsers will translate non-ASCII characters in different parts of the URL.

In the end, you may need to find a RegEx which permits the characters for your language in the permitted portions of the URL.


RE: Use utf-8 fonts in url? - boonstoppel - 06-05-2015

try:
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-\p{L}';

add:
\p{L}

at the end, for international characters