Short-bus / pilomar

RaspberryPi based miniature observatory
https://shortbus.blog/
GNU General Public License v3.0
70 stars 14 forks source link

UnicodeEncodeError: 'latin-1' codec can't encode characters in position 19-89: ordinal not in range(256) #94

Open Short-bus opened 6 days ago

Short-bus commented 6 days ago

This error appears if the Raspberry Pi does not have UTF-8 character set selected.

An example startup output...

Hostname: raspberrypi
Locale: ('en_US', 'ISO8859-1')
...
  File "/home/pi/pilomar/src/textcolor.py", line 409, in TextBox
    print(line)
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 19-89: ordinal not in range(256)
Short-bus commented 6 days ago

The clue is in the output 'Locale: ('en_US', 'ISO8859-1'). The second item should be 'UTF-8'. Pi-lomar expects a UTF-8 environment. In this case the operating system configuration is incorrect. This can be fixed via the Raspberry Pi Configuration utility. Go to the Localisation tab. Select Set Locale. Change the Character Set to UTF-8 Accept [OK] the changes then reboot the RPi.

The detection and error message will be improved in the next pi-lomar release.