diff options
author | Stéphane Graber <stgraber@ubuntu.com> | 2013-07-12 00:19:38 -0400 |
---|---|---|
committer | Stéphane Graber <stgraber@ubuntu.com> | 2013-07-12 10:28:23 -0400 |
commit | ba6e31eba192d6fcfc31d2f8ab2ad811a1322f62 (patch) | |
tree | cd31b5e6f434e0190489a8f54c29d7d5331679e8 | |
parent | d1a6f9dcc97e6fe05707b40364b4bedb3c54d14a (diff) | |
download | bcfg2-ba6e31eba192d6fcfc31d2f8ab2ad811a1322f62.tar.gz bcfg2-ba6e31eba192d6fcfc31d2f8ab2ad811a1322f62.tar.bz2 bcfg2-ba6e31eba192d6fcfc31d2f8ab2ad811a1322f62.zip |
Don't crash when a file diff contains utf-8 chars
This fixes a crash when the client tries to render the diff of a file
which includes unicode characters. This change assumes that utf-8 is the
default encoding, which looking at the rest of the code appears to be a
safe bet.
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
-rw-r--r-- | src/lib/Bcfg2/Client/__init__.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/lib/Bcfg2/Client/__init__.py b/src/lib/Bcfg2/Client/__init__.py index 25603186e..6d1cb9d40 100644 --- a/src/lib/Bcfg2/Client/__init__.py +++ b/src/lib/Bcfg2/Client/__init__.py @@ -21,6 +21,9 @@ def prompt(msg): try: ans = input(msg) return ans in ['y', 'Y'] + except UnicodeEncodeError: + ans = input(msg.encode('utf-8')) + return ans in ['y', 'Y'] except EOFError: # handle ^C on rhel-based platforms raise SystemExit(1) |