Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translation doesn't appear #1

Closed
darnn opened this issue Sep 7, 2018 · 5 comments
Closed

Translation doesn't appear #1

darnn opened this issue Sep 7, 2018 · 5 comments

Comments

@darnn
Copy link

darnn commented Sep 7, 2018

Hi!
I can't seem to get this to work, either in Goldendict or just from the command line.
I have Python 3.7 installed, and have installed requests.
In Goldendict, I get the following error:
Query error: The program has returned exit code 1. Traceback (most recent call last): File "D:\gt\googletranslate.py", line 43, in gtrans() File "D:\gt\googletranslate.py", line 37, in gtrans print(result.encode('gbk', 'ignore').decode('gbk')) File "D:\Python\Python37-32\lib\encodings\cp1255.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode characters in position 33-34: character maps to

@xinebf
Copy link
Owner

xinebf commented Sep 14, 2018

I am using Python 3.7 on Windows 10, there is no problem with the translation of Goldendict, which one is the target language you are using.

@darnn
Copy link
Author

darnn commented Sep 14, 2018

Hebrew. I'm using Windows 7 SP1, and the latest Windows build of the Goldendict beta (1.5.0-RC2-311-g15062f7).

@darnn
Copy link
Author

darnn commented Sep 14, 2018

Wait, so, I should clarify: I get the above error if I try translating into Chinese (zh-CN). When I try translating into Hebrew (he-IL), I only get the original term I was trying to translate:
gt-he-il

@xinebf
Copy link
Owner

xinebf commented Sep 14, 2018

You can replace the two gbk with cp1255 in line 37 of googletranslate.py.

print(result.encode('cp1255', 'ignore').decode('cp1255'))

@darnn
Copy link
Author

darnn commented Sep 14, 2018

Ahh, it works! Thank you! I also have a different bug report (or feature request, depending on how you look at it), but I'll open a separate issue.

@darnn darnn closed this as completed Sep 14, 2018
@xinebf xinebf mentioned this issue Jan 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants