From 4dda042800d9000bb058520ab26ab8636d8f0d85 Mon Sep 17 00:00:00 2001 From: Jason Madigan Date: Mon, 14 Jan 2013 15:25:57 +0000 Subject: [PATCH] #2964 - Fixing urlencoding PG bug in iOS 6 and PG 2.2 --- client/default/js/wufoo.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/client/default/js/wufoo.js b/client/default/js/wufoo.js index 1838c735..2e816323 100644 --- a/client/default/js/wufoo.js +++ b/client/default/js/wufoo.js @@ -981,9 +981,22 @@ $fh.ready(function() { fileEntry.file(function gotFile(file) { var reader = new FileReader(); reader.onloadend = function(evt) { + var text = evt.target.result; + + // Check for URLencoded + // PG 2.2 bug in readAsText() + try { + text = decodeURIComponent(text); + console.log('decoded URLencoded file for key: ' + key); + } catch (e) { + // Swallow exception if not URLencoded + // Just use the result + console.log('file not urlencoded for key: ' + key); + } + return success({ key: key, - val: evt.target.result + val: text }); }; reader.readAsText(file);