You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by phongphan <gi...@git.apache.org> on 2015/10/20 17:03:38 UTC

[GitHub] thrift pull request: DART: Allow decode JSON escaped unicode strin...

GitHub user phongphan opened a pull request:

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

    DART: Allow decode JSON escaped unicode string.

    Hi
    
    This patch allow Dart's json protocol to be able to comsume escaped unicode string (\uXXXX). To make the `readString` test runnable, I have to initialize `_context` variable by calling `_resetContext();` in ctor. Not sure it's safe or not.

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

    $ git pull https://github.com/phongphan/thrift dart-json-escaped-unicode

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

    https://github.com/apache/thrift/pull/658.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 #658
    
----
commit 5302549361fb57ef557901838f13e78bbc3b0f8c
Author: Phongphan Phuttha <ph...@acm.org>
Date:   2015-10-20T14:52:20Z

    DART: Allow decode JSON escaped unicode string.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift pull request: DART: Allow decode JSON escaped unicode strin...

Posted by nsuke <gi...@git.apache.org>.
Github user nsuke commented on the pull request:

    https://github.com/apache/thrift/pull/658#issuecomment-149628493
  
    Hello @phongphan , thanks for the patch, would you mind creating a JIRA ticket for this ?
    http://thrift.apache.org/docs/HowToContribute


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift pull request: DART: Allow decode JSON escaped unicode strin...

Posted by Jens-G <gi...@git.apache.org>.
Github user Jens-G commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/658#discussion_r42543775
  
    --- Diff: lib/dart/lib/src/protocol/t_json_protocol.dart ---
    @@ -321,12 +327,36 @@ class TJsonProtocol extends TProtocol {
             continue;
           }
     
    -      // it's \u00XX
    -      _readJsonSyntaxChar(_Constants.HEX_0_BYTES[0]);
    -      _readJsonSyntaxChar(_Constants.HEX_0_BYTES[0]);
    -      transport.readAll(_tempBuffer, 0, 2);
    -      byte = _hexVal(_tempBuffer[0]) << 4 + _hexVal(_tempBuffer[1]);
    -      bytes.add(byte);
    +      // it's \uXXXX
    +      transport.readAll(_tempBuffer, 0, 4);
    +      byte = (_hexVal(_tempBuffer[0]) << 12)
    +        + (_hexVal(_tempBuffer[1]) << 8)
    +        + (_hexVal(_tempBuffer[2]) << 4)
    +        + _hexVal(_tempBuffer[3]);
    +      if (_isHighSurrogate(byte)) {
    +        if (codeunits.isNotEmpty) {
    --- End diff --
    
    Shouldn't that be `if( codeunits.isEmpty) { throws ... }`, similar to line 344?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift pull request: DART: Allow decode JSON escaped unicode strin...

Posted by phongphan <gi...@git.apache.org>.
Github user phongphan commented on the pull request:

    https://github.com/apache/thrift/pull/658#issuecomment-149635862
  
    Hi @nsuke,
    Thanks, created at [THRIFT-3396](https://issues.apache.org/jira/browse/THRIFT-3396).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift pull request: DART: Allow decode JSON escaped unicode strin...

Posted by phongphan <gi...@git.apache.org>.
Github user phongphan commented on the pull request:

    https://github.com/apache/thrift/pull/658#issuecomment-149763148
  
    Thanks :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift pull request: DART: Allow decode JSON escaped unicode strin...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

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


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---