You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Michael Shuler (JIRA)" <ji...@apache.org> on 2019/06/25 15:31:00 UTC

[jira] [Commented] (CASSANDRA-15182) cqlsh utf_8.py, line 16, in decode return codecs.utf_8_decode(input, errors, True):1:'ascii' codec can't encode character u'\u9ed1' in position 60: ordinal not in range(128)

    [ https://issues.apache.org/jira/browse/CASSANDRA-15182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16872444#comment-16872444 ] 

Michael Shuler commented on CASSANDRA-15182:
--------------------------------------------

(Edited description to remove auth.. (OP should change that))

What is the local {{$LANG}} environment?
Could you post a sanitized and/or simplified schema that reproduces this problem?

{noformat}
(master)mshuler@hana:~/git/ccm$ echo $LANG
en_US.UTF-8

(master)mshuler@hana:~/git/ccm$ ./ccm create test --install-dir=/home/mshuler/git/cassandra
Current cluster is now: test
(master)mshuler@hana:~/git/ccm$ ./ccm populate -n 1
(master)mshuler@hana:~/git/ccm$ ./ccm start

(master)mshuler@hana:~/git/ccm$ ./ccm node1 cqlsh
Connected to test at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.11.5-SNAPSHOT | CQL spec 3.4.4 | Native protocol v4]
Use HELP for help.
cqlsh> CREATE KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}; 
cqlsh> CREATE TABLE test.scratch (a text, b text, PRIMARY KEY (a));
cqlsh> INSERT INTO test.scratch (a, b) VALUES ('黑A00888D', 'something');
cqlsh> SELECT * FROM test.scratch;

 a         | b
-----------+---------------
 黑A00888D | something

(1 rows)
{noformat}

I seem to be able to INSERT and SELECT that character with my local LANG=en_US.UTF-8 env. I believe python-2.7 was not available until RHEL/CentOS 7, so I suspect the local environment and python install may need a little configuration? Just a guess.

> cqlsh utf_8.py, line 16, in decode     return codecs.utf_8_decode(input, errors, True)<stdin>:1:'ascii' codec can't encode character u'\u9ed1' in position 60: ordinal not in range(128)
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-15182
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-15182
>             Project: Cassandra
>          Issue Type: Bug
>          Components: CQL/Interpreter
>            Reporter: gloCalHelp.com
>            Priority: Normal
>
> I use cqlsh 5.0.1 with cassandra 3.11.3 with python2.7.13 in Centos 6.9.
> when I run this cql command: bin/cqlsh hadoop4 -u dba -p ********** --debug  -e "INSERT INTO HYGL_JCSJ.hyjg_ods_yy_gps_novar3 (clcph,dwsj,bc,blbs,cjbzh,ckryid,clid,clmc,ddfx,ddrq,fwj,gd,gdjd,gdwd,jsdlc,jszjl,jxzjl,sjid,sjsfzh,sjxm,sssd,xlmc) VALUES ('黑A00888D','2019-06-2509:57:19',0,,'',,,'379-7038',1434,'2019-06-25',275,0,126723690,45726990 ,796.0,2205,746,'null','null','null',0,'379');"
> I get the error message as below:
> Using CQL driver: <module 'cassandra' from '/home/cassandra/cas3.11.3/bin/../lib/cassandra-driver-internal-only-3.11.0-bb96859b.zip/cassandra-driver-3.11.0-bb96859b/cassandra/__init__.py'>
> Using connect timeout: 5 seconds
> Using 'utf-8' encoding
> Using ssl: False
> Traceback (most recent call last):
>  File "/home/cassandra/cas3.11.3/bin/cqlsh.py", line 926, in onecmd
>  self.handle_statement(st, statementtext)
>  File "/home/cassandra/cas3.11.3/bin/cqlsh.py", line 966, in handle_statement
>  return self.perform_statement(cqlruleset.cql_extract_orig(tokens, srcstr))
>  File "/home/cassandra/cas3.11.3/bin/cqlsh.py", line 1000, in perform_statement
>  success, future = self.perform_simple_statement(stmt)
>  File "/home/cassandra/cas3.11.3/bin/cqlsh.py", line 1053, in perform_simple_statement
>  self.printerr(unicode(err.__class__.__name__) + u": " + err.message.decode(encoding='utf-8'))
>  File "/usr/local/python27/lib/python2.7/encodings/utf_8.py", line 16, in decode
>  return codecs.utf_8_decode(input, errors, True)
> UnicodeEncodeError: 'ascii' codec can't encode character u'\u9ed1' in position 60: ordinal not in range(128)
>  
> this issue seems different with the select command issue on  https://issues.apache.org/jira/browse/CASSANDRA-10875 
> and other method to add "-*- coding: utf-8 -*- " in the head of cqlsh.py ,  can anyone hurry up to teach me?
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org