terryyin / translate-python

Online translation as a Python module & command line tool. No key, no authentication needed.
MIT License
724 stars 155 forks source link

Apostrophes are printed as special caracters (FR) #79

Open GDelevoye opened 3 years ago

GDelevoye commented 3 years ago

Hello :)

First of all what a great module really !!! The default translator is awesome for basic usage (so is mine) I just had one small disappointment about the apostrophes printed as special caracters when trying to translate in french

(gl) guillaume@A320MA:~$ translate-cli -t fr "That's his fault not mine"

Translation: C'est sa faute pas la mienne
-------------------------
Translated by: MyMemory

I thought this could have something to do with the terminal's encoding so I tried in pure python3/utf-8 and got the same result

>>> translator= Translator(to_lang="fr")
>>> translation = translator.translate("That's cool isn't it ?")
>>> print(translation)
C'est cool non ?

It's very surprising to me since even mandarin seems to print properly

I was using translate, version 3.5.0 on Ubuntu x86 LTS20 with python 3.7.1 (anaconda)

For now I can use a small hotfix (a simple ".replace("'","'") should do) but maybe it could be fixed idk ? :)

Thanks again for the good work however :+1: