Issue #80: Unable to open large json files on android 2.2 + phonegap 0.9.5

I could not get rid of the url encoding and decoding without hampering some users ability to pass non-ascii characters back to JavaScript.  However, I was able to reduce the amount of data being passed from Java to JavaScript by 40% by decoding common characters that occur in JSON and XML.  These characters will survive the round trip just fine and don't need to be encoded.

This is the best solution I could come up with.  You won't be able to read files as large as you could in 0.9.4 but it will get close and it will support non-ascii characters.
This commit is contained in:
macdonst
2011-06-01 02:54:18 +08:00
parent 39ec9c095d
commit 992ee0bca4
2 changed files with 46 additions and 4 deletions
+2 -2
View File
@@ -767,8 +767,8 @@ PhoneGap.JSCallback = function() {
// If callback has JavaScript statement to execute
if (xmlhttp.status === 200) {
// Need to url decode the response and replace %20 with a space
var msg = decodeURIComponent(xmlhttp.responseText.replace(/\+/g, '%20'));
// Need to url decode the response
var msg = decodeURIComponent(xmlhttp.responseText);
setTimeout(function() {
try {
var t = eval(msg);