Skip to content

Commit

Permalink
fix: Restore special characters for Google Translate API results.
Browse files Browse the repository at this point in the history
  • Loading branch information
bookfere committed Dec 8, 2024
1 parent ba2f83d commit 357e337
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion engines/google.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import time
import json
import os.path
from html import unescape
from subprocess import Popen, PIPE

from ..lib.utils import traceback_error
Expand Down Expand Up @@ -184,7 +185,7 @@ def get_body(self, text):

def get_result(self, data):
translations = json.loads(data)['data']['translations']
return ''.join(i['translatedText'] for i in translations)
return ''.join(unescape(i['translatedText']) for i in translations)


class GoogleBasicTranslate(GoogleBasicTranslateADC):
Expand Down

0 comments on commit 357e337

Please sign in to comment.