You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@shindig.apache.org by "Chris Chabot (JIRA)" <ji...@apache.org> on 2009/12/01 12:37:20 UTC

[jira] Commented: (SHINDIG-1229) MakeRequest::decodeUtf8() seems to be broken in some cases

    [ https://issues.apache.org/jira/browse/SHINDIG-1229?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12784184#action_12784184 ] 

Chris Chabot commented on SHINDIG-1229:
---------------------------------------

Indeed, both issues had a good looking fix to them, and I was waiting to have a moment to test out your supplied use-case before closing this one; If you can confirm it did indeed work for you that'be great.

Thanks!

> MakeRequest::decodeUtf8() seems to be broken in some cases
> ----------------------------------------------------------
>
>                 Key: SHINDIG-1229
>                 URL: https://issues.apache.org/jira/browse/SHINDIG-1229
>             Project: Shindig
>          Issue Type: Bug
>          Components: PHP
>    Affects Versions: 1.1-BETA5
>         Environment: PHP Shindig (r881567) / PHP 5.2.4 
>            Reporter: Matthieu Huguet
>         Attachments: decodeUtf8.diff, json-response.txt
>
>
> I have a gadget which is fetching some JSON data from a  remote PHP script with makeRequest :
> Client code :
> -----------------
> [...]
> var params = {};
> params[gadgets.io.RequestParameters.AUTHORIZATION] = gadgets.io.AuthorizationType.SIGNED;
> params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.JSON;
> params['OWNER_SIGNED'] = true;
> params['VIEWER_SIGNED'] = true;
> gadgets.io.makeRequest(url, callback params);
> [...]
> JSON reponse :
> ----------------------
> JSON data contains some special characters (in UTF-8) and are encoded with json_encode().
> In some cases, some characters are filtered out by MakeRequest::decodeUtf8().
> Here is an example :
> * The remote PHP script is returning  :
>      json_encode(array("test" => "Désolé"));
>     (See the full http response in json-response.txt attachment.)
> * In MakeRequest::decodeUtf8(), here is how $content is transformed :
>      1 (original) :    {"test":"D\u00e9sol\u00e9"}
>      2 (after the second preg_replace. the first one is not executed) :    {"test":"D&#233;&#233;"}
>      3 (after  mb_decode_numericentity) :  {"test":"Déé"}
> The weird thing is that only non-special characters are filtered out.
> Is it something wrong with my Json encoded data ?
> I've no problem while decoding them with json_decode() function.
> I've tried to add charset=UTF-8 in my Content-Type response, but it changes nothing.
> Some help will be really appreciated ! Thanks

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.