T
TanStack2mo ago
flat-fuchsia

Path param being transformed into invalid URL/URI part

Hello, Not sure if this is being caused by TanStack router but it is reproable by going to https://codesandbox.io/p/devbox/github/tanstack/router/tree/main/examples/react/start-basic?embed=1&theme=dark and going to either of these paths: /users/S%C3%A5k%C3%BAr%C3%A5 /users/Såkúrå You should get an error: URI malformed Both of these paths should be valid as calling decodeURI("https://rj3ftd-3000.csb.app/users/S%C3%A5k%C3%BAr%C3%A5") results in 'https://rj3ftd-3000.csb.app/users/Såkúrå' In my project, the Såkúrå part is being transformed into S%E5k%FAr%E5 before the page loads, for some reason. Any idea what's going on here?
7 Replies
eastern-cyan
eastern-cyan2mo ago
Path Params | TanStack Router React Docs
Path params are used to match a single segment (the text until the next /) and provide its value back to you as a named variable. They are defined by using the $ character prefix in the path, followed...
flat-fuchsia
flat-fuchsiaOP2mo ago
it seems like Såkúrå shouldn't be considered malformed then right? encodeURIComponent("Såkúrå") produces S%C3%A5k%C3%BAr%C3%A5. Perhaps I'm misunderstanding something? looks like S%E5k%FAr%E5 is in Windows-1252 encoding
eastern-cyan
eastern-cyan2mo ago
cc @Sean Cassiere
flat-fuchsia
flat-fuchsiaOP2mo ago
StackBlitz
Router Basic File Based Example - StackBlitz
Run official live example code for Router Basic File Based, created by Tanstack on StackBlitz
flat-fuchsia
flat-fuchsiaOP2mo ago
in case this helps, it seems that when utf-8 encoded params are used a redirect happens to the windows-1252 encoded url:
No description
eastern-cyan
eastern-cyan2mo ago
can you please create a GitHub issue for this? please link the example I am unsure whether this is a bug or not but we should track it and investigate
flat-fuchsia
flat-fuchsiaOP2mo ago
Sure, I’ll make an issue.

Did you find this page helpful?