-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Routes with non-ascii characters are not matched in SSR #3110
Comments
I'm closing #838 in favor of this. As a note (because that issue is quite outdated). URL have specific encoding rules that make { path: '/%C3%A9', alias: '/é' } However, this shouldn't be necessary because a URL like A possible workaround to this problem is to automatically duplicate the records, one encoded, and the other one decoded |
Thanks @posva for the quick reply, Vue-router should be able to handle both encoded and decoded url versions. As the server might receive the encoded version, then Example: route: { path: '/é', component: MyComponent } Requested url:
The comparison/matching done by vue-router should be done also between This will result in successful matching instead of 404. The current ssr behaviour is as follows: if route is: both if route is:
However when in the browser, route I suggest modification of vue-router code to cater for this issue by comparing the request url with both versions of the route path (encoded and decoded) and if either one matches then route should be used. (considering vue-router code that runs in server and also code that runs in client) Suggested workaround (alias or duplication) works, but cumbersome. I'll be happy to submit a PR if you help me locate the relevant code. Supporting non-ascii urls is important cos most of the people in the world are non-english speakers! |
Another thinking might be: |
As mentioned above, using only I assume this is because the server is receiving So at the moment we are forced to add aliases or duplicates which is cumbersome and counter-productive (and might add a performance impact for large number of routes) As a side note, for code readability we prefer to use @posva can you clarify if this would be easy to implement or there is some complexities that should be considered. |
Version
3.1.5
Reproduction link
https://github.com/ejez/vue-router-ssr-issue
Steps to reproduce
http://localhost:8080/à-propos
What is expected?
Route should match and browser should show page contents
What is actually happening?
404 error in terminal
When on client, the previous route is matched and works normally, this can be checked by initially visiting http://localhost:8080 , and then clicking on the link "Go To à-propos".
Another route without "non-ascii characters" is provided to show that it works normally both in ssr and client:
http://localhost:8080/about
The text was updated successfully, but these errors were encountered: