You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ty...@apache.org on 2015/08/14 17:45:21 UTC
[3/5] cassandra git commit: cqlsh: specify encoding w/ command line
option
cqlsh: specify encoding w/ command line option
Patch by Paulo Motta; reviewed by Tyler Hobbs for CASSANDRA-10004
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/7a6a5097
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/7a6a5097
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/7a6a5097
Branch: refs/heads/cassandra-2.2
Commit: 7a6a5097a35feb830b66a7e602ba3cb1ead2e105
Parents: 972ae14
Author: Paulo Motta <pa...@gmail.com>
Authored: Fri Aug 14 10:40:58 2015 -0500
Committer: Tyler Hobbs <ty...@gmail.com>
Committed: Fri Aug 14 10:40:58 2015 -0500
----------------------------------------------------------------------
CHANGES.txt | 1 +
bin/cqlsh | 7 ++++++-
2 files changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/7a6a5097/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index f7fb63c..5a76978 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
2.1.9
+ * (cqlsh) Allow encoding to be set through command line (CASSANDRA-10004)
* Add new JMX methods to change local compaction strategy (CASSANDRA-9965)
* Write hints for paxos commits (CASSANDRA-7342)
* (cqlsh) Fix timestamps before 1970 on Windows, always
http://git-wip-us.apache.org/repos/asf/cassandra/blob/7a6a5097/bin/cqlsh
----------------------------------------------------------------------
diff --git a/bin/cqlsh b/bin/cqlsh
index 69b669d..084d586 100755
--- a/bin/cqlsh
+++ b/bin/cqlsh
@@ -165,6 +165,9 @@ 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("--cqlshrc", help="Specify an alternative cqlshrc file location.")
parser.add_option('--cqlversion', default=DEFAULT_CQLVER,
help='Specify a particular CQL version (default: %default).'
@@ -2331,6 +2334,7 @@ def read_options(cmdlineargs, environment):
optvalues.debug = False
optvalues.file = None
optvalues.ssl = False
+ optvalues.encoding = None
optvalues.tty = sys.stdin.isatty()
optvalues.cqlversion = option_with_default(configs.get, 'cql', 'version', DEFAULT_CQLVER)
@@ -2461,7 +2465,8 @@ def main(options, hostname, port):
ssl=options.ssl,
single_statement=options.execute,
client_timeout=options.client_timeout,
- connect_timeout=options.connect_timeout)
+ connect_timeout=options.connect_timeout,
+ encoding=options.encoding)
except KeyboardInterrupt:
sys.exit('Connection aborted.')
except CQL_ERRORS, e: