From 4d27935a25f6970076d3531a66f904b423deed84 Mon Sep 17 00:00:00 2001 From: Yuriy Novostavskiy Date: Wed, 28 Feb 2024 22:13:41 +0200 Subject: [PATCH] ensure that return string is not unicode-escaped --- bot/plugins/deepl.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bot/plugins/deepl.py b/bot/plugins/deepl.py index 813122a..062ac40 100644 --- a/bot/plugins/deepl.py +++ b/bot/plugins/deepl.py @@ -49,4 +49,5 @@ class DeeplTranslatePlugin(Plugin): "text": kwargs['text'], "target_lang": kwargs['to_language'] } - return requests.post(url, headers=headers, data=data).json()["translations"][0]["text"] \ No newline at end of file + translated_text = requests.post(url, headers=headers, data=data).json()["translations"][0]["text"] + return translated_text.encode('unicode-escape').decode('unicode-escape') \ No newline at end of file