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

[jira] [Comment Edited] (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=16872865#comment-16872865 ] 

gloCalHelp.com edited comment on CASSANDRA-15182 at 6/26/19 2:03 AM:
---------------------------------------------------------------------

Thanks Sir Michael, because the report error position is not correct, and

I don't know how to santize the insert sql, but the shorter one with a Chinese character can be successfully inserted as below:

INSERT INTO HYGL_JCSJ.hyjg_ods_yy_gps_novar3 (clcph,dwsj,bc) VALUES 
 ('黑A00888D','2019-06-25 09:57:19',0);", and my LANG environment is really this:

bash-4.1$ echo $LANG
en_US.UTF-8

        Is there anyone who can tell me how to make cqlsh report the correct position of wrong sql except using --debug variable?

 

    


was (Author: glocalhelp.com):
Thanks Sir Michael, because the report error position is not correct, and

I don't know how to santize the insert sql, but the shorter one with a Chinese character can be successfully inserted as below:

INSERT INTO HYGL_JCSJ.hyjg_ods_yy_gps_novar3 (clcph,dwsj,bc) VALUES 
('黑A00888D','2019-06-25 09:57:19',0);"

        Is there anyone who can tell me how to make cqlsh report the correct position of wrong sql except using --debug variable?

 

    

> 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