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

Luis Nell commented on THRIFT-1460:
-----------------------------------

I just verified if this bug still exists with the latest trunk (with pycassa 
1.6.0, (i)python 2.7.1, cassandra 1.1) and it doesn't.

{code}
# cassandra connection setup etc. left out.
# Insert and Get of unicode data:
>>> import uuid
>>> uid = uuid.uuid4()
>>> MYCF.insert(uid, {'öäü': 'ñasdâé'})
1337510467426464  # timestamp of modification
>>> MYCF.get(uid)
OrderedDict([(u'\xf6\xe4\xfc', u'\xf1asd\xe2\xe9')])
>>> print MYCF.get(uid)[u'öäü']
ñasdâé
>>> ENTITY.insert(uid, {'name': u'Shaq\u2013Kobe feud'})  # now with the above 
>>> testcase.
1337510579083911
>>> ENTITY.get(uid)
OrderedDict([(u'name', u'Shaq\u2013Kobe feud'), (u'\xf6\xe4\xfc', 
u'\xf1asd\xe2\xe9')])
>>> print ENTITY.get(uid)['name']
Shaq–Kobe feud
>>> ENTITY.get(uid)['name'].encode('utf8')
'Shaq\xe2\x80\x93Kobe feud'
{code}

As you can see it works. In case anyone here is not that familiar with python 
and/or unicode: the 'encode()' translates a string from one encoding to another 
with the provided translation map. In this case utf8 is translated to ascii via 
the utf8 mapping, supplied as argument to 'encode()'.

                
> why not add unicode strings support to python directly?
> -------------------------------------------------------
>
>                 Key: THRIFT-1460
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1460
>             Project: Thrift
>          Issue Type: Bug
>          Components: Python - Library
>    Affects Versions: 0.8
>         Environment: redhat linux
>            Reporter: shen guanpu
>            Assignee: Jake Farrell
>              Labels: python, unicode
>             Fix For: 0.9
>
>
> i install thrift python lib by easy_install
> but in version0.8,I still didn't see the 
> patch(https://issues.apache.org/jira/browse/THRIFT-395) be added in the lib
> I had to hack the code follow the patch manually 
> (https://issues.apache.org/jira/secure/attachment/12404198/0003-THRIFT-395.-python-Phase-Two-of-support-for-unicode.patch)
> Can any of the developers fix the problem?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to