diff --git a/src/utils.ts b/src/utils.ts index d82e4ec9..849c0aa8 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -301,7 +301,7 @@ export function isEqual(a: string, b: string, options: CompareURLOptions = {}) { export function withFragment(input: string, hash: string): string { const parsed = parseURL(input); - parsed.hash = hash === "" ? "" : "#" + encodeURI(hash); + parsed.hash = hash === "" ? "" : "#" + encodeHash(hash); return stringifyParsedURL(parsed); }