robwolff3/google-assistant-webserver

Wrong UTF8 encoding setting

zewelor opened this issue · 2 comments

Hi

I'm getting encoding error:

2019-01-12T19:26:30.480952308Z  ON_CONVERSATION_TURN_STARTED -                                                                                                                                                                
2019-01-12T19:26:30.482750476Z  Traceback (most recent call last):
2019-01-12T19:26:30.482861749Z    File "/gawebserver.py", line 182, in <module>                                                                                                                                                   
2019-01-12T19:26:30.483008450Z      main()
2019-01-12T19:26:30.483045945Z    File "/gawebserver.py", line 179, in main                                                                                                                                                       
2019-01-12T19:26:30.483104911Z      process_event(event)
2019-01-12T19:26:30.483134133Z    File "/gawebserver.py", line 70, in process_event
2019-01-12T19:26:30.483193397Z      print(event)
2019-01-12T19:26:30.483222601Z  UnicodeEncodeError: 'ascii' codec can't encode character '\u2026' in position 92: ordinal not in range(128)

From what I've found, it because of wrong locale env setting, and it can be fixed using PYTHONIOENCODING=utf-8. I've put it in docker run command and seems to work fine.

Hey, sorry I didn't see this issue sooner.

That's interesting, I have not seem that error before. Ill add it to an issues section. Thanks for contributing this fix!

This fix doesnt work for me. I still get the error:

gawebserver    |     self._lib.assistant_send_text_query(self._inst, query.encode('ASCII'))
gawebserver    | UnicodeEncodeError: 'ascii' codec can't encode character '\xdc' in position 10: ordinal not in range(128)

I even tried adding the German Local to my Docker-Compose

environment:
      - PYTHONIOENCODING=utf-8
      - LANG=de_DE.UTF-8