cqlsh: change default encoding to UTF-8

patch by Paulo Motta; reviewed by Stefania Alborghetti for CASSANDRA-11124
This commit is contained in:
Paulo Motta 2016-02-17 15:25:59 -03:00 committed by Jason Brown
parent 77ff794737
commit 66b0d3f016
3 changed files with 7 additions and 10 deletions

View File

@ -30,7 +30,7 @@ Merged from 2.1:
* Make it clear what DTCS timestamp_resolution is used for (CASSANDRA-11041)
* test_bulk_round_trip_blogposts is failing occasionally (CASSANDRA-10938)
* (cqlsh) Support timezone conversion using pytz (CASSANDRA-10397)
* cqlsh: change default encoding to UTF-8 (CASSANDRA-11124)
2.2.5
* maxPurgeableTimestamp needs to check memtables too (CASSANDRA-9949)

View File

@ -209,9 +209,8 @@ parser.add_option('-k', '--keyspace', help='Authenticate to the given keyspace.'
parser.add_option("-f", "--file", help="Execute commands from FILE, then exit")
parser.add_option('--debug', action='store_true',
help='Show additional debugging information')
parser.add_option("--encoding", help="Specify a non-default encoding for output. If you are " +
"experiencing problems with unicode characters, using utf8 may fix the problem." +
" (Default from system preferences: %s)" % (locale.getpreferredencoding(),))
parser.add_option("--encoding", help="Specify a non-default encoding for output." +
" (Default: %s)" % (UTF8,))
parser.add_option("--cqlshrc", help="Specify an alternative cqlshrc file location.")
parser.add_option('--cqlversion', default=DEFAULT_CQLVER,
help='Specify a particular CQL version (default: %default).'
@ -737,10 +736,6 @@ class Shell(cmd.Cmd):
self.session.max_trace_wait = max_trace_wait
self.tty = tty
if encoding is None:
encoding = locale.getpreferredencoding()
if encoding is None:
encoding = UTF8
self.encoding = encoding
self.check_windows_encoding()
@ -2358,7 +2353,7 @@ def read_options(cmdlineargs, environment):
optvalues.debug = False
optvalues.file = None
optvalues.ssl = False
optvalues.encoding = None
optvalues.encoding = option_with_default(configs.get, 'ui', 'encoding', UTF8)
optvalues.tty = option_with_default(configs.getboolean, 'ui', 'tty', sys.stdin.isatty())
optvalues.cqlversion = option_with_default(configs.get, 'cql', 'version', DEFAULT_CQLVER)
@ -2471,6 +2466,7 @@ def main(options, hostname, port):
if options.debug:
sys.stderr.write("Using CQL driver: %s\n" % (cassandra,))
sys.stderr.write("Using connect timeout: %s seconds\n" % (options.connect_timeout,))
sys.stderr.write("Using '%s' encoding\n" % (options.encoding,))
# create timezone based on settings, environment or auto-detection
timezone = None

View File

@ -42,7 +42,8 @@
;; Used for automatic completion and suggestions
; completekey = tab
;; The encoding used for characters
; encoding = utf8
; To use another than the system default browser for cqlsh HELP to open
; the CQL doc HTML, use the 'browser' preference.