You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Arya Goudarzi (JIRA)" <ji...@apache.org> on 2012/07/22 03:59:35 UTC

[jira] [Commented] (THRIFT-1224) Cannot insert UTF-8 text

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

Arya Goudarzi commented on THRIFT-1224:
---------------------------------------

Alexis solution has fixed most of our issues with inserting UTF-8 strings into Cassandra, however, we have now been getting the classic 'end of file reached' error sporadically which tells me it somehow messed up the proper frame for the transport.
                
> Cannot insert UTF-8 text
> ------------------------
>
>                 Key: THRIFT-1224
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1224
>             Project: Thrift
>          Issue Type: Bug
>          Components: Ruby - Library
>    Affects Versions: 0.6
>         Environment: Ruby 1.9.2, Cassandra 0.8, thrift_client gem 0.6.2, cassandra gem 0.11.1
>            Reporter: Alessandro Morandi
>            Assignee: Jake Farrell
>              Labels: charset, encoding, ruby, utf, utf-8, utf8
>             Fix For: 0.9
>
>
> I can't seem to find a way to save UTF-8 data into Cassandra.
> I'm using the cassandra gem 0.11.1 (https://github.com/fauna/cassandra/) which in turn uses thrift_client (0.6.2), which in turns uses the thrift library (0.6.0).
> As an example, the following code[1]
> bq. cassandra.insert(:Cache, "123", {"unicode string" => "รค"})
> will raise an exception:
> bq.    {{Encoding::CompatibilityError: incompatible character encodings: ASCII-8BIT and UTF-8}}
> The stacktrace points to `thrift-0.6.0/lib/thrift/transport/framed_transport.rb:58`. What seems to be happening is that `@wbuf` is encoded as ASCII-8BIT, while `buf` is encoded as UTF-8, which causes the concatenation operation (<<) to fail with the exception above.
> This issue might be connected to https://issues.apache.org/jira/browse/THRIFT-1023.
> [1] Of course, this assumes a "cassandra" object created using the cassandra gem and a schema inizialized with a column family called "Cache"

--
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