@@ -171,6 +171,9 @@ public function handle(string $uri = null)
171171 : $ this ->controller ;
172172 }
173173
174+ // Decode URL-encoded string
175+ $ uri = urldecode ($ uri );
176+
174177 if ($ this ->checkRoutes ($ uri ))
175178 {
176179 if ($ this ->collection ->isFiltered ($ this ->matchedRoute [0 ]))
@@ -420,12 +423,12 @@ protected function checkRoutes(string $uri): bool
420423
421424 // Replace it with a regex so it
422425 // will actually match.
423- $ key = str_replace ('/ ' , '\/ ' , $ key );
426+ $ key = str_replace ('/ ' , '\/ ' , $ key );
424427 $ key = str_replace ('{locale} ' , '[^\/]+ ' , $ key );
425428 }
426429
427430 // Does the RegEx match?
428- if (preg_match ('#^ ' . $ key . '$# ' , $ uri , $ matches ))
431+ if (preg_match ('#^ ' . $ key . '$#u ' , $ uri , $ matches ))
429432 {
430433 // Is this route supposed to redirect to another?
431434 if ($ this ->collection ->isRedirect ($ key ))
@@ -470,12 +473,12 @@ protected function checkRoutes(string $uri): bool
470473 if (strpos ($ val , '$ ' ) !== false && strpos ($ key , '( ' ) !== false && strpos ($ key , '/ ' ) !== false )
471474 {
472475 $ replacekey = str_replace ('/(.*) ' , '' , $ key );
473- $ val = preg_replace ('#^ ' . $ key . '$# ' , $ val , $ uri );
476+ $ val = preg_replace ('#^ ' . $ key . '$#u ' , $ val , $ uri );
474477 $ val = str_replace ($ replacekey , str_replace ('/ ' , '\\' , $ replacekey ), $ val );
475478 }
476479 elseif (strpos ($ val , '$ ' ) !== false && strpos ($ key , '( ' ) !== false )
477480 {
478- $ val = preg_replace ('#^ ' . $ key . '$# ' , $ val , $ uri );
481+ $ val = preg_replace ('#^ ' . $ key . '$#u ' , $ val , $ uri );
479482 }
480483 elseif (strpos ($ val , '/ ' ) !== false )
481484 {
0 commit comments