UrlManager route utf8 characters

Hi guys.

I have problem with my urlManager configuration.

For example I have next route

"company/<company:\w+>"=>"/site/showCompany/company/<company>"

When I use url like:

/company/foobar

Then this route works fine.

But when I try to use some latin1 special characters such as æ or å or ø

/company/foobarå

Then this route doesn’t work.

How this can be fixed? I guess that i need to change application locale through set_locale, but I’m not sure.

Thanks.

Try


"company/<company:[^/]+>"=>"/site/showCompany/company/<company>"

Thanks, but this doesn’t work.

I got error:

The URL pattern "<product_id:\d+>/<country:\d+>/<serial:[^/]+>/<mail:[^/]+>/<name:[^/]+>/<company:[^/]+>" for route "/site/index/product_id/<product_id>/country_code/<country>/serial/<serial>/mail/<mail>/name/<name>/company/<company>" is not a valid regular expression.

My route is:




'<product_id:\d+>/<country:\d+>/<serial:[^/]+>/<mail:[^/]+>/<name:[^/]+>/<company:[^/]+>'=>

                    '/site/index/product_id/<product_id>/country_code/<country>/serial/<serial>/mail/<mail>/name/<name>/company/<company>',



Sorry, I forgot to escape / inside regex.

Thanks Alex.

Just a note: Are you sure you want to use these characters in your URLs? As far as i know only a very specific set of characters is allowed in valid URLs. Moreover i would have no chance to type them on my german keyboard.

See this section of RFC 3986 about URI:

http://tools.ietf.org/html/rfc3986#section-2.3

Would you please say how you changed your code? I have the same problem!

for those who came from SE

[^/]+ => [^\/]+

Can i progam url routing by my own laws ?

In good e-commerces like OPEN-CART, MAGENTO,… you have url like this:

mysite.com/мужские-одежди/носки-pumma-желтый-67

I need to find suitable controller, action and id to render the page.