[ https://issues.apache.org/jira/browse/SHINDIG-1229?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Matthieu Huguet closed SHINDIG-1229. ------------------------------------ Resolution: Duplicate Fixed in #SHINDIG-1235 ... > 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éé"} > 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.