codeigniterurl-rewritingurlencodecodeigniter-urlnon-english

Are non-english characters 100% supported in codeigniter urls by default?


I want to be sure if this behavior is 100% supported in CodeIgniter.

What doubts me is that in config.php the permitted_uri_chars is as followed:

$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';

It says that only English chars are allowed. BUT consider the results of following urls:

Result: The URI you submitted has disallowed characters.

Result: No problem!!!

The word سلام (which is in Persian and means "hello") cannot be accepted by the pattern 'a-z 0-9~%.:_\-', but it doesn't error like the previous example!

Why does this behavior happen?

Now the next question: Is there any NEED to add and include Persian characters in the pattern?

I was thinking of changing the config.php to be like this:

$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';

// Add all the persian characters after standard pattern:
$config['permitted_uri_chars'] .= 'آابپتثجچحخدذرزسشصضطظعغفقکگلمنوهیي‌۱۲۳۴۵۶۷۸۹۰';

Solution

  • Non-ASCII character should be URLEncoded converting them to %F3 etc. Which I believe would be allowed based on the % and a-z 0-9