From ff17e540c759acdf89130aefb203a9fb40bc69d1 Mon Sep 17 00:00:00 2001 From: Chesterkxng Date: Fri, 18 Jul 2025 19:52:23 +0200 Subject: [PATCH] fix: updated decode method to handle special characters like emojis and others --- src/pages/tools/string/url-decode/service.ts | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/src/pages/tools/string/url-decode/service.ts b/src/pages/tools/string/url-decode/service.ts index 5a5b622..7eaef1c 100644 --- a/src/pages/tools/string/url-decode/service.ts +++ b/src/pages/tools/string/url-decode/service.ts @@ -1,20 +1,4 @@ export function decodeString(input: string): string { if (!input) return ''; - - let result = ''; - let i = 0; - - while (i < input.length) { - if (input[i] === '%' && i + 2 < input.length) { - const hex = input.substring(i + 1, i + 3); - const code = parseInt(hex, 16); - result += String.fromCodePoint(code); - i += 3; - } else { - result += input[i]; - i++; - } - } - - return result; + return decodeURIComponent(input); }