You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2015/10/01 18:15:26 UTC

[jira] [Commented] (THRIFT-3364) Fix ruby binary field encoding in TJSONProtocol

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

ASF GitHub Bot commented on THRIFT-3364:
----------------------------------------

GitHub user nsuke opened a pull request:

    https://github.com/apache/thrift/pull/633

    THRIFT-3364 Fix ruby binary field encoding in TJSONProtocol

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/nsuke/thrift THRIFT-3364

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/thrift/pull/633.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #633
    
----
commit e428ffaec48097153b3399215c94d4199121657a
Author: Nobuaki Sukegawa <ns...@gmail.com>
Date:   2015-10-01T15:47:10Z

    THRIFT-3364 Fix ruby binary field encoding in TJSONProtocol

----


>   Fix ruby binary field encoding in TJSONProtocol
> -------------------------------------------------
>
>                 Key: THRIFT-3364
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3364
>             Project: Thrift
>          Issue Type: Sub-task
>          Components: Ruby - Library
>    Affects Versions: 0.9.3
>            Reporter: Nobuaki Sukegawa
>
> Ruby JSON protocol uses pack('m') method to encode Base64 string.
> It seems that it inserts a "\n" character every 60 characters.
> You can refer to these pages for this behavior.
> http://stackoverflow.com/questions/2620975/strange-n-in-base64-encoded-string-in-ruby
> http://ruby-doc.org/stdlib-2.2.3/libdoc/base64/rdoc/Base64.html
> {quote}
> Line feeds are added to every 60 encoded characters.
> {quote}
> This has been making it impossible to send long binary field data to other languages.
> I fixed this by using alternative encode method that is added in Ruby 1.9 (which should be OK).
> After the fix, I had to add Ruby namespace to DebugProtoTest.thrift to avoid name collision of "Base64" symbols that is used for new encode method and also as DebugProtoTest message name.
> I also removed extraneous double quote in encoded binary fields that resulted in invalid JSON.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)