Rnhmjoj
Rnhmjoj

Reputation: 883

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?

Upvotes: 5

Views: 1453

Answers (1)

Rizky Hardy
Rizky Hardy

Reputation: 21

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

Upvotes: 2

Related Questions