aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/util
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2011-04-08 14:21:45 -0400
committerW. Trevor King <wking@drexel.edu>2011-04-08 14:25:57 -0400
commit44cbfdc1e8e9c6c7fb115c7ea101e2532d58e436 (patch)
tree7bce01eeb0bb131e1bd08a96d06fb64687affcbd /libbe/util
parent79c84af65d250b5a372693ac835f0730ca18edf3 (diff)
downloadbugseverywhere-44cbfdc1e8e9c6c7fb115c7ea101e2532d58e436.tar.gz
Fix command-line encoding processing.
String command-line options are converted to unicode using the input encoding. We use the fact that Python sets up the original sys.stdout to determine the terminal encoding. This should fix Anders Sneckenborg's issues with Swedish characters: C:\temp\slask4>be new "Svenska tecken åäö" Created bug with ID 6be/5c3 C:\temp\slask4> C:\temp\slask4> C:\temp\slask4>be list ERROR: 'ascii' codec can't decode byte 0xe5 in position 15: ordinal not in range(128) You should set a locale that supports unicode, e.g. export LANG=en_US.utf8 See http://docs.python.org/library/locale.html for details
Diffstat (limited to 'libbe/util')
-rw-r--r--libbe/util/encoding.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/libbe/util/encoding.py b/libbe/util/encoding.py
index 5950bb9..c759529 100644
--- a/libbe/util/encoding.py
+++ b/libbe/util/encoding.py
@@ -49,11 +49,14 @@ def get_input_encoding():
return get_encoding()
def get_output_encoding():
- return get_encoding()
+ return sys.__stdout__.encoding
def get_filesystem_encoding():
return get_encoding()
+def get_argv_encoding():
+ return get_encoding()
+
def known_encoding(encoding):
"""
>>> known_encoding("highly-unlikely-encoding")