mouuff / mtranslate

A simple api for google translate
MIT License
286 stars 83 forks source link

How to fix this error? #12

Closed rvslan closed 7 years ago

rvslan commented 7 years ago

File "/opt/virtualenvs/ros/local/lib/python2.7/site-packages/mtranslate/core.py", line 72, in translate to_translate = urllib.quote_plus(to_translate) File "/usr/lib/python2.7/urllib.py", line 1299, in quote_plus s = quote(s, safe + ' ') File "/usr/lib/python2.7/urllib.py", line 1294, in quote return ''.join(map(quoter, s)) KeyError: u'\xe8' I think this because I need to use unicode. It's possible to use unicode?

ryaoi commented 7 years ago

to_translate = "the sentece that you want to translate" translate(to_translate.encode('utf-8'), "en", "auto") this might help you.

rvslan commented 7 years ago

thanks its work