Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utf-8 slug character doesn't work in url #3089

Closed
perspolise opened this issue Jun 12, 2020 · 5 comments
Closed

utf-8 slug character doesn't work in url #3089

perspolise opened this issue Jun 12, 2020 · 5 comments

Comments

@perspolise
Copy link

I add persian character to uri like this:

http://ci4.local:8080/تماس-با-ما

in routes.php :

$routes->get('/(:any)', 'Home::page/$1');

but i see this error:

Object not found!

The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.
Error 404
ci4.local
Apache/2.4.41 (Win64) OpenSSL/1.1.1c PHP/7.4.2 

@lonnieezell
Copy link
Member

While I'm not 100% sure what's causing this particular error to show up, be aware that the HTTP spec requires characters other than US_ASCII to be url-encoded. That means that those characters are, unfortunately, disallowed by the spec.

@michalsn
Copy link
Member

I think that non-ASCII characters are automatically translated to ASCII by the server. But it's only my guess (I haven't checked).

Anyway, looking at the error I would say that this is not a CodeIgniter problem. Probably .htaccess? I would try to call http://ci4.local:8080/index.php/تماس-با-ما to check if this will work.

@lonnieezell
Copy link
Member

I cannot recreate using the latest CI develop branch and the built-in server.

I added the route:

$routes->get('/(:any)', 'Home::page/$1');

and modified the default controller by adding this method:

public function page($page = null)
{
	dd($page);
}

Visiting the URL localhost:8080/تماس-با-ما works just fine for me. Likely a server issue.

If you need additional help please visit the forums and ask there.

@perspolise
Copy link
Author

perspolise commented Jun 13, 2020

@lonnieezell I check all persian character. codeigniter .htaccess have a problem with ‍م‍ character. I change:

RewriteRule ^(.*)$ index.php/$1 [L]

to

RewriteRule ^([\s\S]*)$ index.php/$1 [L,NC,QSA]

and my problem with م character is fixed now.

i think my apache web server, have problem with this character.

@lonnieezell
Copy link
Member

Good find. I've included that in the latest code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants