You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CLI/Display: use utf-8 (or non-ascii) encoding (#400)
We were hardcoding the use of 'ascii' encoding in CLI/Display.py which
was not a good idea.
Default string encoding in Python 2 is 'ascii', while it is 'utf-8' in
Python 3, so we can't just use str.encode() without argument. We don't
want to use 'ascii' encoding, so let's force to 'utf-8' encoding unless
the system provides a default to some other encoding. In Python 3, it
will default to 'utf-8' which is what we want anyway.
This patch also fixes the scope of ValueError exception handling in
clubak() for Display() object initializer. UnicodeEncodingError actually
inherits from ValueError so this error appeared as an option mismatch to
the user but this was definitively not. Any other ValueError like
UnicodeEncodingError is now catched in Clubak.main() instead.
Fixes#400 (clubak --diff fails on non-ascii text)
Change-Id: I9ea1e49df9c39bfa03f35f88f8b20a65ad6c98b1
0 commit comments