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•2mo ago
the transformation happens based on this:
https://tanstack.com/router/latest/docs/framework/react/guide/path-params#allowed-characters
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-fuchsiaOP•2mo 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 encodingeastern-cyan•2mo ago
cc @Sean Cassiere
flat-fuchsiaOP•2mo ago
doesn't seem to happen on the basic router example: https://stackblitz.com/github/tanstack/router/tree/main/examples/react/basic-file-based?embed=1&theme=dark&preset=node&file=src/routes/__root.tsx
StackBlitz
Router Basic File Based Example - StackBlitz
Run official live example code for Router Basic File Based, created by Tanstack on StackBlitz
flat-fuchsiaOP•2mo ago
in case this helps, it seems that when utf-8 encoded params are used a redirect happens to the windows-1252 encoded url:

eastern-cyan•2mo 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-fuchsiaOP•2mo ago
Sure, I’ll make an issue.