Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UnicodeEncodeError when using python from ssh

I made a small application that prints unicode special characters(i.e. superscript, subscript...). When it runs locally there are no problems but when it runs in a ssh session I always get a UnicodeEncodeError. Specifically: UnicodeEncodeError 'ascii' can't encode characters in position 0-1: ordinal not in range(128) I tried different ssh clients, computers and double checked the sessions encoding but the result is the same. This is really weird. Why does this happen? Is this really related to ssh?

like image 790
Rnhmjoj Avatar asked Nov 03 '22 19:11

Rnhmjoj


1 Answers

The problem might be not your Python code, check your ssh ENV. LANG should be en_US.UTF-8 (containing UTF-8) not ASCII

like image 144
Rizky Hardy Avatar answered Nov 10 '22 04:11

Rizky Hardy