[ https://issues.apache.org/jira/browse/THRIFT-1766?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13948807#comment-13948807 ]
Vanja Bucic commented on THRIFT-1766: ------------------------------------- There are still some issues though. A simple example of binary usage does not work - it ignores the binary flag, calls 'write_string' instead of 'write_binary' which in turn bombs in encode. Did not want to reopen this issue or create another one until someone takes a look at it. Of note is that struct.c seems to be missing any references to binary types. The test case is small, I'll just paste it here. {code:title=binary_test.thrift|borderStyle=solid} namespace rb BinaryTest struct KVPair { 1: string key 2: binary value } service BTest { void aservice(1:string myid, 2:KVPair data); } {code} {code:title=test_bin.rb|borderStyle=solid} transport = Thrift::MemoryBufferTransport.new() protocol = Thrift::CompactProtocol.new(transport) client = BinaryTest::BTest::Client.new(protocol) transport.open() kv = BinaryTest::KVPair.new kv.key = 'my_bin_key' kv.value = 0.upto(255).map { |i| i.chr }.join '' client.aservice 'some_key', kv {code} results in: "\x80" from ASCII-8BIT to UTF-8 {color:red} /opt/local/lib/ruby2.1/gems/2.1.0/gems/thrift-0.9.1/lib/thrift/bytes.rb:89:in `encode' {color} /opt/local/lib/ruby2.1/gems/2.1.0/gems/thrift-0.9.1/lib/thrift/bytes.rb:89:in `convert_to_utf8_byte_buffer' {color:red} /opt/local/lib/ruby2.1/gems/2.1.0/gems/thrift-0.9.1/lib/thrift/client.rb:36:in `write_string' {color} /opt/local/lib/ruby2.1/gems/2.1.0/gems/thrift-0.9.1/lib/thrift/client.rb:36:in `write' /opt/local/lib/ruby2.1/gems/2.1.0/gems/thrift-0.9.1/lib/thrift/client.rb:36:in `send_message' /Users/vanjab/RubymineProjects/RubyBase_SVN/scratch/vanjab/thrift/binary_test/gen-rb/b_test.rb:21:in `send_aservice' /Users/vanjab/RubymineProjects/RubyBase_SVN/scratch/vanjab/thrift/binary_test/gen-rb/b_test.rb:16:in `aservice' > [Ruby] Provide support for binary types > --------------------------------------- > > Key: THRIFT-1766 > URL: https://issues.apache.org/jira/browse/THRIFT-1766 > Project: Thrift > Issue Type: Sub-task > Components: Ruby - Library > Affects Versions: 0.9 > Reporter: Nathan Beyer > Assignee: Nathan Beyer > Attachments: THRIFT-1766-provide-support-for-binary-types.patch > > > The Ruby library didn't provide explicit support for 'binary' types, which > sort of worked on Ruby 1.8.7 and with Thrift 0.8, but it doesn't work with > Ruby 1.9.3 and the encoding changes that were included with Thrift 0.9. > This issue is intended to provide first class support for the 'binary' type. -- This message was sent by Atlassian JIRA (v6.2#6252)