get_output_encoding falls back to get_encoding if sys.__stdout__ is redirected.
authorW. Trevor King <wking@drexel.edu>
Fri, 15 Apr 2011 00:47:27 +0000 (20:47 -0400)
committerW. Trevor King <wking@drexel.edu>
Fri, 15 Apr 2011 00:47:27 +0000 (20:47 -0400)
libbe/util/encoding.py

index c759529fdf6ce8d99783853278a44b5e64775744..3cc425dc9167d27935e8d18a82ce1c81bf41b31c 100644 (file)
@@ -49,7 +49,7 @@ def get_input_encoding():
     return get_encoding()
 
 def get_output_encoding():
-    return sys.__stdout__.encoding
+    return sys.__stdout__.encoding or get_encoding()
 
 def get_filesystem_encoding():
     return get_encoding()