Enable piping to cqlsh with locale.getpreferredencoding()
Patch by paul cannon, reviewd by brandonwilliams for CASSANDRA-4113


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/be9fa05d
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/be9fa05d
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/be9fa05d

Branch: refs/heads/trunk
Commit: be9fa05d06063ed84dca8f9ce6d3be5439359231
Parents: 452619c
Author: Brandon Williams <brandonwilli...@apache.org>
Authored: Tue May 15 17:19:04 2012 -0500
Committer: Brandon Williams <brandonwilli...@apache.org>
Committed: Tue May 15 17:19:04 2012 -0500

----------------------------------------------------------------------
 bin/cqlsh |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/be9fa05d/bin/cqlsh
----------------------------------------------------------------------
diff --git a/bin/cqlsh b/bin/cqlsh
index 7a9d0a3..d3d4eb4 100755
--- a/bin/cqlsh
+++ b/bin/cqlsh
@@ -45,6 +45,7 @@ import time
 import optparse
 import ConfigParser
 import codecs
+import locale
 import re
 
 # cqlsh should run correctly when run out of a Cassandra source tree,
@@ -408,7 +409,7 @@ class Shell(cmd.Cmd):
 
         self.color = color
         if encoding is None:
-            encoding = sys.stdout.encoding
+            encoding = locale.getpreferredencoding()
         self.encoding = encoding
         self.output_codec = codecs.lookup(encoding)
 

Reply via email to