smartdevicelink / generic_hmi

A sample HMI to use with sdl_core
BSD 3-Clause "New" or "Revised" License
8 stars 27 forks source link

deploy_server.sh crash with UTF8 PTU #483

Closed iCollin closed 2 years ago

iCollin commented 2 years ago

Bug Report

The delpoy_server.sh script (start_server.py) will crash if provided with a UTF8 PTU using characters > 127

Expected Behavior

The server continues successfully with PTU

Observed Behavior

The server crashes

Error in connection handler
Traceback (most recent call last):
  File "/usr/web/python/python_websocket/src/websockets/server.py", line 193, in handler
    await self.ws_handler(self, path)
  File "/usr/web/python/python_websocket/src/start_server.py", line 149, in on_connect
    await rpc_service.on_receive(message)
  File "/usr/web/python/python_websocket/src/start_server.py", line 190, in on_receive
    print('\033[1;2m***Message received: %s\033[0m' % _msg)
UnicodeEncodeError: 'ascii' codec can't encode character '\xf6' in position 19395: ordinal not in range(128)
Browser & Version Information
Test Case, Sample Code, and / or Example App

I believe this crash can be avoided with sys.stdout.reconfigure(encoding='utf-8') in python 3.7 and higher

ShobhitAd commented 2 years ago

Closed via https://github.com/smartdevicelink/generic_hmi/pull/491