From 177d7124904d84ce38102ba3255c5dccc6adb35b Mon Sep 17 00:00:00 2001
From: Maxim Nikolenko <maximnproductengine@lindenlab.com>
Date: Mon, 7 Aug 2023 20:17:18 +0300
Subject: [PATCH] =?UTF-8?q?SL-20086=20es=D1=81ape=20the=20message=20text?=
 =?UTF-8?q?=20before=20sending?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 indra/newview/lltranslate.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/indra/newview/lltranslate.cpp b/indra/newview/lltranslate.cpp
index 9344eeb5738..6182c96597f 100644
--- a/indra/newview/lltranslate.cpp
+++ b/indra/newview/lltranslate.cpp
@@ -725,7 +725,7 @@ bool LLAzureTranslationHandler::parseResponse(
         return false;
     }
 
-    translation = first["text"].asString();
+    translation = LLURI::unescape(first["text"].asString());
 
     return true;
 }
@@ -825,8 +825,13 @@ LLSD LLAzureTranslationHandler::sendMessageAndSuspend(LLCoreHttpUtil::HttpCorout
 {
     LLCore::BufferArray::ptr_t rawbody(new LLCore::BufferArray);
     LLCore::BufferArrayStream outs(rawbody.get());
+
+    static const std::string allowed_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz "
+                                             "0123456789"
+                                             "-._~";
+
     outs << "[{\"text\":\"";
-    outs << msg;
+    outs << LLURI::escape(msg, allowed_chars);
     outs << "\"}]";
 
     return adapter->postRawAndSuspend(request, url, rawbody, options, headers);
-- 
GitLab