Hey my routing script isnt working with special chars and i dont have any idea anymore why or how to fix it.
My Url: /test/x/hállò/123
My Router added URL: /test/:varx/:variableZ/123
$route['url'] ="/test/x/:name/123";
$reqMet = $_SERVER['REQUEST_METHOD'];
$route['method'] = "GET";
$reqUrl = "/test/x/hállò/123";
$matches = Array();
$pattern = "@^" . preg_replace('/\\\:[a-zA-Z0-9\_\-]+/', '([a-zA-Z0-9\-\_]+)', preg_quote($route['url'])) . "$@D";
if($reqMet == $route['method'] && preg_match($pattern, $reqUrl, $matches)) {
echo "THIS SHOULD BE THE OUTPUT";
}
So its not working with words like lòl or Háy but i get back the correct Url but with things like article/test/123 all is perfect.
Hope someone have a fix for me. Thanks
EDIT
So this is working
$router->addRoute('GET','/test/x/hállò/123','home/main',false);
URL >> http://localhost/test/x/hállò/123
BUT this not
$router->addRoute('GET','/test/x/:name/123','home/main',false`);
URL >> http://localhost/test/x/hállò/123
:name is for variables which are replaceable like Article id oder whatever.