Issues

ZF-6661: Make routers, especially Zend_Controller_Router_Route_Regex, UTF8 compatible

Description

Hi!

It would be very nice if Zend_Controller routers will be able to route a routes with an UTF8 symbols in it. That feature allows to create truly i18n web-sites, like Wikipedia.

It is very easy to add an UTF8 support to, for example, Zend_Controller_Router_Route_Regex - just add 'u' modifier to the route regexp:

Code starting at line 73:

public function match($path, $partial = false)
{
    if (!$partial) {
        $path = trim(urldecode($path), '/');
        $regex = '#^' . $this->_regex . '$#i';
    } else {
        $regex = '#^' . $this->_regex . '#i';
    }

just should be changed to

public function match($path, $partial = false)
{
    if (!$partial) {
        $path = trim(urldecode($path), '/');
        $regex = '#^' . $this->_regex . '$#iu';
    } else {
        $regex = '#^' . $this->_regex . '#iu';
    }

Adding unicode support slows down PHP PCRE engine and it would be wise to create a special construct-time flag to allow programmer decide if he/she really needs an UTF8 support in routes.

And as usual: thanks for the Framework! :)

Comments

Bulk change of all issues last updated before 1st January 2010 as "Won't Fix".

Feel free to re-open and provide a patch if you want to fix this issue.