Closed One1Tick closed 6 months ago
Hi, what (Terminal etc) are you using to display this text? I'd assume the issue is there, the API returns accented characters correctly, but maybe they are not rendered correctly on your screen by the console. To verify this, you could write the translation to a file like this
import deepl
auth_key = "myKey"
translator = deepl.Translator(auth_key)
result = translator.translate_text("The Code GPT extension requires your OpenAI API key", target_lang = "FR")
print(result.text)
with open('output_tmp.txt', 'w') as f:
f.write(result.text)
and check the produced output_tmp.txt
file, it should contain the accented characters.
To enable unicode in your console, for Windows there's a SO answer here
For Mac OS, Apple has some instructions here
Linux should default to UTF-8, which can render this - if it doesn't work on Linux, please check for your distro/terminal or post here with the exact software you are using.
Thanks @JanEbbing. The problem was in vscode, it works correctly when launching the script in a windows terminal. Should be a vscode config issue. thanks anyway for your help.
When I translate to french I got issue with accented characters. The py file is encoded under UTF-8.
import deepl auth_key = "myKey" translator = deepl.Translator(auth_key) result = translator.translate_text("The Code GPT extension requires your OpenAI API key", target_lang = "FR") print(result.text)
Result is "L'extension Code GPT n�cessite votre cl� API OpenAI" with � instead of é. What is the issue. Thanks and sorry for the newbie question.