mirror of
https://github.com/aljazceru/chatgpt-telegram-bot.git
synced 2025-12-22 07:04:59 +01:00
add Accept-Encoding: utf-8 to header
reason for this change is avoiding to get unicode escape characters in response for non-ANSI characters potential fix for issue #541
This commit is contained in:
@@ -42,10 +42,11 @@ class DeeplTranslatePlugin(Plugin):
|
||||
headers = {
|
||||
"Authorization": f"DeepL-Auth-Key {self.api_key}",
|
||||
"User-Agent": "chatgpt-telegram-bot",
|
||||
"Content-Type": "application/x-www-form-urlencoded"
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"Accept-Encoding": "utf-8"
|
||||
}
|
||||
data = {
|
||||
"text": kwargs['text'],
|
||||
"target_lang": kwargs['to_language']
|
||||
}
|
||||
return requests.post(url, headers=headers, data=data).json()["translations"][0]["text"]
|
||||
return requests.post(url, headers=headers, data=data).json()["translations"][0]["text"]
|
||||
Reference in New Issue
Block a user