Need help with CI 2.0 and cyrillic urls

#1
[eluser]Unknown[/eluser]
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:
Code:
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_-а-яА-Я';
3. In config/routes.php I'm using this:
Code:
$route['тест'] = "test";
... tried also with:
Code:
$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?

Thanks!

#2
[eluser]ka-spot[/eluser]
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~%.:_\-абвгдеёжзийклмнопрстуфхцчшщъыьэюя';

?

#3
[eluser]PhilTem[/eluser]
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
ru.wikipedia.org/wiki/Компьютер: Russian Wikipedia uses Cyrillic URLs however, they are encoded as soon as you will copy the URL.

[edit]
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

#4
[eluser]ka-spot[/eluser]
Actually it's working with encoded $route's, but I forgot to post it here. This is working:

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

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

Code:
http://localhost/вход



edit: my post is decoded..

#5
[eluser]CroNiX[/eluser]
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.

#6
[eluser]0v3rth3d4wn[/eluser]
Hi! I'm having the same problem. For some reason on my previous project this worked:
Code:
$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:
Code:
$cyrillic = array('а','б','в','г','д','е','ж','з','и','й','к','л','м','н','о','п','р','с','т','у','ф','х','ц','ч','ш','щ','ь','ъ','ю','я');
function enc(&$item)
{
$item = urlencode($item);
};
array_walk($cyrillic,'enc');
$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:
Code:
$route[urlencode('контакти')] = 'contact';


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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