pudb
pudb copied to clipboard
UnicodeEncodeError: 'latin-1' codec can't encode character '\u21a6' i
While debugging using pudb
I got this error in between:
byte_count = len(line[i:i+column_count].encode(_target_encoding))
UnicodeEncodeError: 'latin-1' codec can't encode character '\u21a6' in position 3: ordinal not in range(256)
Anybody already know these error, then please let me know how to takle it.
Thanks!
We'll need an example file to reproduce this bug in order to help you. Also, are you on Python2 or 3? What version of pudb?
Also what is the output of the locale
command?
This is the output for locale
command :
shekharrajak@HackerDude ➜ ~ locale
LANG=en_IN
LANGUAGE=en_IN:en
LC_CTYPE=en_IN
LC_NUMERIC="en_IN"
LC_TIME="en_IN"
LC_COLLATE="en_IN"
LC_MONETARY="en_IN"
LC_MESSAGES="en_IN"
LC_PAPER="en_IN"
LC_NAME="en_IN"
LC_ADDRESS="en_IN"
LC_TELEPHONE="en_IN"
LC_MEASUREMENT="en_IN"
LC_IDENTIFICATION="en_IN"
LC_ALL=
I will share the example file to repproduce it .
The issue will probably go away if you set your locale to en_IN.UTF-8
. See https://www.cyberciti.biz/faq/how-to-set-locales-i18n-on-a-linux-unix/.
Even so, pudb shouldn't crash on characters that it can't encode.
Thannks @asmeurer , I will try it out.