mcongrove / ChariTi

Please do not use: this is out-dated
Other
113 stars 85 forks source link

Issues with JSON data in Asian text #175

Closed morefun0302 closed 11 years ago

morefun0302 commented 11 years ago

Asian text in JSON sometimes encoded with format of &#x????; rather that \u????. Please refer to the attached facebook JSON feed.

This make the text unreadable after parsing data.

I changed he code case "json": _data = JSON.parse(this.responseText.replace(/&#x/gi, "\u").replace(/;/gi, "")); in http.js to solve it.

See if you have a better solution.

example facebook feed: http://www.facebook.com/feeds/page.php?format=json&id=376703082419041 (title is in &#x????; content is in \u????)

mcongrove commented 11 years ago

I tried making this change:

_data = JSON.parse(this.responseText.replace(/&#x[a-zA-z0-9]{4};/ig, "\u"));

But received the following error:

[WARN] :   : ERROR: Invalid hex-character pattern in string [http.js:35,77]
[ERROR] :  Error generating AST for "/Users/matthewcongrove/Documents/Titanium_Studio_Workspace/Chariti/Resources/http.js"
[ERROR] :  Invalid hex-character pattern in string
[ERROR] :  line 35, column 77, position 1158
[ERROR] :  Alloy compiler failed

Not sure why. Did you receive that error? Do you still receive it using TiMob 3.1.3?

mcongrove commented 11 years ago

I completely re-did the decoding; it works, now... 2013-10-04_1319