Enable piping to cqlsh with locale.getpreferredencoding()

Patch by paul cannon, reviewd by brandonwilliams for CASSANDRA-4113
This commit is contained in:
Brandon Williams 2012-05-15 17:19:04 -05:00
parent 452619cd07
commit be9fa05d06
1 changed files with 2 additions and 1 deletions

View File

@ -45,6 +45,7 @@ import time
import optparse import optparse
import ConfigParser import ConfigParser
import codecs import codecs
import locale
import re import re
# cqlsh should run correctly when run out of a Cassandra source tree, # cqlsh should run correctly when run out of a Cassandra source tree,
@ -408,7 +409,7 @@ class Shell(cmd.Cmd):
self.color = color self.color = color
if encoding is None: if encoding is None:
encoding = sys.stdout.encoding encoding = locale.getpreferredencoding()
self.encoding = encoding self.encoding = encoding
self.output_codec = codecs.lookup(encoding) self.output_codec = codecs.lookup(encoding)