[Flow] Using Chinese characters as Identity for Object Route Parts

Bastian Waidelich bastian at typo3.org
Tue Oct 21 10:43:51 CEST 2014


Rocky wrote:

Hi Rocky(?),

> The system I am developing uses Chinese Only [...]
> But in the address bar I got http://mydomain.com/dashboard/school/-2
> instead of http://mydomain.com/dashboard/school/测试学校. Any idea please?

This is meant to be a feature, but since URLs can contain special 
characters it's probably a bug (or at least it should be configurable)..
But there is a solution:

The culprit is IdentityRoutePart::rewriteForUri() [1] that "cleans up" 
URLs using a really simple transliteration..
You can just copy/extend that class, adjust the code and then use your 
custom RoutePartHandler like:

-
   name: 'DashboardSchool'
   uriPattern: 'dashboard/school/{school}'
   defaults:
     '@package': 'Hwwcn.Sponsor'
     '@controller': 'Dashboard'
     '@action': 'school'
     '@format': 'html'
   routeParts:
     school:
       handler: '\Hwwcn\Sponsor\Routing\YourCustomRoutePartHandler'


see [2] for more details on this topic.

HTH

[1] 
https://git.typo3.org/Packages/TYPO3.Flow.git/blob/86230e97875cd35615f81ec7e802207f9271d262:/Classes/TYPO3/Flow/Mvc/Routing/IdentityRoutePart.php#l303

[2] 
http://docs.typo3.org/flow/TYPO3FlowDocumentation/TheDefinitiveGuide/PartIII/Routing.html#route-part-handlers


-- 
Bastian Waidelich


More information about the Flow mailing list