0

I try to use this python text-to-speech converter to convert Greek into mp3. Git says utf-8 is supported but when I try to translate text like "Γεια σου" it throws an error as shown below:

What I type on cmd: gtts-cli.py "Γεια σου" -l el -o hi.mp3
What I get:

'ascii' codec can't decode byte 0xf4 in position 0: ordinal not in range(128)

Any ideas?

Update:

I added utf-8 support as shown below. I even updated to python3. Still getting a similar error...

'utf8' codec can't decode byte 0xc3 in position 0: invalid continuation byte

What I added:

text = args.text.decode('utf-8')

Any ideas?

4
  • Try: u"Γεια σου" Commented Sep 8, 2017 at 12:17
  • Also, add quoation marks around "el": gtts-cli.py "Γεια σου" -l "el" -o hi.mp3 Commented Sep 8, 2017 at 12:19
  • None of these worked. Same error :/ Commented Sep 8, 2017 at 12:32
  • 1
    Try to run your script in python3. It usually solve this kind of issues, assuming of course your script is python3 compatible. If it doesn't work, then you probably need to decode() / encode() your inputs/outputs in your script. This can be easier to say than to do though. Commented Sep 8, 2017 at 12:48

1 Answer 1

1

There is related open issue in this project, please take a look.
Looks like the fix was created by the somebody already though, but it is still not merged.

Sign up to request clarification or add additional context in comments.

2 Comments

Alright, I added the commit to my files. I even updated to python3. Still getting a similar error... 'utf8' codec can't decode byte 0xc3 in position 0: invalid continuation byte
Do you run modified version or just the same command as previously? If you installed gTTS via pip, you could be using unpatched version

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.