From ba393cd6423bfa84b3b16e77ffea9d36a8b034d2 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Thu, 31 Aug 2023 18:39:18 -0500 Subject: [PATCH] encode all unsafe characters in post text for translate URL (#1345) --- src/locale/helpers.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/locale/helpers.ts b/src/locale/helpers.ts index 6e6e3f08..3ada8ef0 100644 --- a/src/locale/helpers.ts +++ b/src/locale/helpers.ts @@ -80,5 +80,7 @@ export function isPostInLanguage( } export function getTranslatorLink(text: string): string { - return encodeURI(`https://translate.google.com/?sl=auto&text=${text}`) + return `https://translate.google.com/?sl=auto&text=${encodeURIComponent( + text, + )}` }