aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Pipping <sebastian@pipping.org>2014-10-29 02:09:31 +0100
committerSebastian Pipping <sebastian@pipping.org>2014-10-29 02:09:35 +0100
commit525e6b4807ba338b11921849c53ba05f939e53db (patch)
tree5a5aa6fe8293f546ce2740afd9b1960c4daa4246
parentFix crash for locale without explicit encoding (Gentoo bug #527240) (diff)
downloadelogv-525e6b4807ba338b11921849c53ba05f939e53db.tar.gz
elogv-525e6b4807ba338b11921849c53ba05f939e53db.tar.bz2
elogv-525e6b4807ba338b11921849c53ba05f939e53db.zip
Save one round of encoding/decoding back and forth0.7.6.6
-rwxr-xr-xelogv7
1 files changed, 4 insertions, 3 deletions
diff --git a/elogv b/elogv
index a33046b..4225577 100755
--- a/elogv
+++ b/elogv
@@ -189,12 +189,13 @@ def date2str(d):
raise ValueError('Cannot decode byte stream')
try:
- u.encode('ascii')
+ b = u.encode('ascii')
except UnicodeEncodeError:
# Prevent crash locales like ja_JP.UTF-8, e.g. "2014年10月24日"
# https://bugs.gentoo.org/show_bug.cgi?id=464962
- u = u.encode('ascii', errors='replace').decode('ascii')
- return u
+ b = u.encode('ascii', errors='replace')
+
+ return b
# Main class (called with curses.wrapper later)
class ElogViewer: