Need help with CI 2.0 and cyrillic urls

Hello guys,

I've a little problem with urls in cyrillic on CI 2.0

1. I installed clean CI 2.0
2. In config/config.php I'm using this:
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_-а-яА-Я';
3. In config/routes.php I'm using this:
$route['тест'] = "test";
... tried also with:
$route['тест'] = "test/index";

I have properly configured controller and view - test.php ( it's a copy of the default welcome.php ).

And finally for http://localhost/тест I get:
Quote:404 Page Not Found

The page you requested was not found.

Anybody, any ideas how to solve this issue?


is there a fix for this with CI 2.1.1?

I have exactly the same problem except that I'm using: $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-абвгдеёжзийклмнопрстуфхцчшщъыьэюя';


I'm not sure that there's a fix (haven't checked it though), but I think it's not fixed since it's more an encoding problem than a Cyrillic URL problem. Every character gets encoded in an URL (like you sometimes see the in URLs, that's an encoded white-space).

So basically I think you would have to add the encoded representations of your Cyrillic characters to the permitted_uri_chars

PS: Just a little exampleКомпьютер: Russian Wikipedia uses Cyrillic URLs however, they are encoded as soon as you will copy the URL.

Wow, this forum even can handle Cyrillic URLs. That's why the URL you can see when hovering over my link is a full Cyrillic URL. I thought it had the same output as where I took it from right here

Actually it's working with encoded $route's, but I forgot to post it here. This is working:

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

$route['вход'] = "login/index";


edit: my post is decoded..

You would need to add each individual character to the permitted_characters. There isn't a regex range that can be used for that, like was posted in the first post (-а-яА-Я). There is for English characters [a-z], but not others that I am aware.

Using routes is another workaround.

Hi! I'm having the same problem. For some reason on my previous project this worked:
$config['permitted_uri_chars'] = 'a-z 0-9~%&.:_\-абвгдежзийклмнопрстуфхцчшщьъюя';

But now on this new project I'm working it isn't. So I read about having to encode each character and tried this:
$cyrillic = array('а','б','в','г','д','е','ж','з','и','й','к','л','м','н','о','п','р','с','т','у','ф','х','ц','ч','ш','щ','ь','ъ','ю','я');
function enc(&$item)
$item = urlencode($item);
$config['permitted_uri_chars'] = 'a-z 0-9~%&.:_\-'.implode('',$cyrillic);

When I echo the imploded $cyrillic array it returns the encoded chars but my routing is still not working. Am I doing this right?

I really would not want to type on every routing the urlencode function like this:
$route[urlencode('контакти')] = 'contact';

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.