thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bryan Duxbury <br...@rapleaf.com>
Subject Re: utf8strings in Thrift 0.5.0-RC1
Date Wed, 06 Oct 2010 00:18:08 GMT
Any pythonistas that can chime in here?

On Mon, Oct 4, 2010 at 4:30 PM, Dan Gould <dlg@dangould.com> wrote:

>  Hi,
>
> I'm invoking Thrift as
> $ thrift --gen py:new_style,utf8strings ...
>
> However, I'm getting this exception when sending:
>  File "model/graphdb/graphdb/Graph.py", line 923, in send_update_person
>    args.write(self._oprot)
>  File "model/graphdb/graphdb/Graph.py", line 5334, in write
>    oprot.writeString(self.one_line_bio)
>  File
> "hsn/hsn_virtualenv/lib/python2.6/site-packages/thrift/protocol/TBinaryProtocol.py",
> line 123, in writeString
>    self.trans.write(str)
>  File
> "hsn/hsn_virtualenv/lib/python2.6/site-packages/thrift/transport/TTransport.py",
> line 164, in write
>    self.__wbuf.write(buf)
> UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in
> position 1: ordinal not in range(128)
>
> I expected it to send UTF-8 and that line 5334 in that traceback would
> read:
> oprot.writeString(self.one_line_bio.encode('utf-8'))
>
> per https://issues.apache.org/jira/browse/THRIFT-395
> and, specifically
>
> http://svn.apache.org/viewvc/incubator/thrift/trunk/compiler/cpp/src/generate/t_py_generator.cc:
1998
>
> Am I missing something I have to do to enable unicode support in Thrift
> (sorry, I'm a beginner)?
>
> Thanks
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message