URIs with german special characters don't work (error 404). I've already had this problem (here) and it has been resolved with the unicode modifier and a custom view helper, that uses it.
Now I have the same issue with a Segment
child route, but this time the approach with the unicode identifier and a custom view helper isn't working.
Alle requests like sld.tld/sport/sport??ü??ü?/city??ü??ü?
or sld.tld/sport/sport??ü??ü?/city??ü??ü?/page/123
are ending with a 404
error.
/module/Catalog/config/module.config.php
<?php
return array(
...
'router' => array(
'routes' => array(
'catalog' => array(
...
),
'city' => array(
...
),
// works correctly, if I remove the child route
'sport' => array(
'type' => 'MyNamespaceMvcRouterHttpUnicodeRegex',
'options' => array(
'regex' => '/catalog/(?<city>[p{L}p{Zs}]*)/(?<sport>[p{L}p{Zs}]*)',
'defaults' => array(
'controller' => 'CatalogControllerCatalog',
'action' => 'list-courses',
),
'spec' => '/catalog/%city%/%sport%',
),
'may_terminate' => true,
'child_routes' => array(
'courses' => array(
'type' => 'segment',
'options' => array(
'route' => '[/page/:page]',
'defaults' => array(
'controller' => 'CatalogControllerCatalog',
'action' => 'list-courses',
),
),
'may_terminate' => true,
),
)
),
),
),
...
);
I've also tried it with a UnicodeRegex
child route:
'sport' => array(
'type' => 'MyNamespaceMvcRouterHttpUnicodeRegex',
'options' => array(
'regex' => '/catalog/(?<city>[p{L}p{Zs}]*)/(?<sport>[p{L}p{Zs}]*)',
'defaults' => array(
'controller' => 'CatalogControllerCatalog',
'action' => 'list-courses',
),
'spec' => '/catalog/%city%/%sport%',
),
'may_terminate' => true,
'child_routes' => array(
'courses' => array(
'type' => 'MyNamespaceMvcRouterHttpUnicodeRegex',
'options' => array(
'regex' => '/page/(?<page>[p{N}]*)',
'defaults' => array(
'controller' => 'CatalogControllerCatalog',
'action' => 'list-courses',
),
'spec' => '/page/%page%',
),
'may_terminate' => true,
),
)
),
UnicodeRegex
see here
UnicodeSegment
Extends ZendMvcRouterHttpSegment
and completes the input of ALL preg_match(...)
calls with u
:
How to get it working?
See Question&Answers more detail:
os