2016-03-30 19 views
2

Ich habe Codierungsproblem mit Cqlsh.CQLSH Problem mit Sonderzeichen

Wenn ich versuche, Textdaten mit Sonderzeichen einfügen mit CQLSH Befehl:

cqlsh localhost -k my_keyspace -f /home/me/workspace/scripts/test.cql 

(test.cql die folgende Zeile enthält):

INSERT INTO table_content (tableId, title, content) VALUES ('record1', 'Mon titre', 'Mon contenu avec un accent évidemment'); 

ich die folgende Fehlermeldung erhalten:

Traceback (most recent call last): 
File "/opt/applications/apache-cassandra-2.1.8/bin/cqlsh", line 2459, in <module> 
main(*read_options(sys.argv[1:], os.environ)) 
File "/opt/applications/apache-cassandra-2.1.8/bin/cqlsh", line 2451, in main 
shell.cmdloop() 
    File "/opt/applications/apache-cassandra-2.1.8/bin/cqlsh", line 940, in cmdloop 
    line = self.get_input_line(self.prompt) 
    File "/opt/applications/apache-cassandra-2.1.8/bin/cqlsh", line 909, in get_input_line 
    self.lastcmd = self.stdin.readline() 
    File "/usr/lib/python2.7/codecs.py", line 672, in readline 
    return self.reader.readline(size) 
    File "/usr/lib/python2.7/codecs.py", line 527, in readline 
    data = self.read(readsize, firstline=True) 
    File "/usr/lib/python2.7/codecs.py", line 474, in read 
    newchars, decodedbytes = self.decode(data, self.errors) 
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 26: ordinal not in range(128) 

Meine Datei ist in UTF-8 obwohl codiert. Irgendeine Idee, wie man UTF-8 Kodierung für cqlsh Befehlszeile erzwingt? Ich benutze die folgende Version (und ich habe keine Wahl): [cqlsh 5.0.1 | Kassandra 2.1.8 | CQL-Spezifikation 3.2.0 | Natives Protokoll v3]

Antwort

2

Es gab ein Problem in cql 5.0.1, das jetzt im gelösten Zustand ist. Wenn Sie nicht aktualisieren können dann folgende Lösung erwähnt:

Das Problem behoben wurde durch die Linie 1135 von cqlsh.py Ändern

readline.add_history (new_hist) -> readline.add_history (new_hist. kodieren ('utf8'))

More Details

+0

Ok, danke. Ich denke, das löst mein Problem, aber ich habe keine Erlaubnis, solche Patches anzuwenden. Danke trotzdem. – Mathyeux