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

Implement Cyrillic route paths #3317

Closed
ignatevdev opened this issue Apr 14, 2016 · 2 comments
Closed

Implement Cyrillic route paths #3317

ignatevdev opened this issue Apr 14, 2016 · 2 comments

Comments

@ignatevdev
Copy link

Hello. I'm building an application using the latest react-router. We want to implement the route paths containing Cyrillic symbols in it, like
<Route path="/пример" component={Example} />
However, this doesn't seem to be working by default, therefore I would like to ask, is it possible to create such routes or can the support of Cyrillic routes be included into the next release?

@taion
Copy link
Contributor

taion commented Apr 14, 2016

We don't currently automatically encode URI segments in paths for pattern matching. There are some complexities in doing so. Take a look at e.g. pillarjs/path-to-regexp#42 and pillarjs/router#15 for the concerns from the Express team.

I don't think we can really handle this satisfactorily on our end right now. Can you just encode the relevant URI segments yourself?

@ignatevdev
Copy link
Author

ignatevdev commented Apr 14, 2016

@taion Thanks a lot!
For anyone who runs into the same issue, the solution is to simply encode your UTF-8 string before passing it into the route.
In my case, an example for this would look like
<Route path={encodeURIComponent('пример')} component={Example} />
And with using route params you should write it like this
<Route path={encodeURIComponent('пример') + '/:id'} component={Example} />

The issue is solved.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants