From a1e4655bbcb7f6682689391975dfda5a60a304de Mon Sep 17 00:00:00 2001 From: Steven Wittens Date: Sun, 22 Jan 2006 17:37:41 +0000 Subject: [PATCH] - #44939: Fix Unicode autocomplete in IE --- misc/autocomplete.js | 3 +-- misc/drupal.js | 9 ++++++--- misc/upload.js | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/misc/autocomplete.js b/misc/autocomplete.js index 6cb72518cfc..f680ef727a7 100644 --- a/misc/autocomplete.js +++ b/misc/autocomplete.js @@ -222,7 +222,6 @@ jsAC.prototype.found = function (matches) { */ function ACDB(uri) { this.uri = uri; - this.max = 15; this.delay = 300; this.cache = {}; } @@ -241,7 +240,7 @@ ACDB.prototype.search = function(searchString) { var db = this; this.timer = setTimeout(function() { addClass(db.owner.input, 'throbbing'); - HTTPGet(db.uri +'/'+ searchString +'/'+ db.max, db.receive, db); + HTTPGet(db.uri +'/'+ encodeURIComponent(searchString), db.receive, db); }, this.delay); } diff --git a/misc/drupal.js b/misc/drupal.js index 7f3a44cea99..b962c89f76a 100644 --- a/misc/drupal.js +++ b/misc/drupal.js @@ -38,7 +38,9 @@ if (typeof XMLHttpRequest == 'undefined') { } /** - * Creates an HTTP GET request and sends the response to the callback function + * Creates an HTTP GET request and sends the response to the callback function. + * + * Note that dynamic arguments in the URI should be escaped with encodeURIComponent(). */ function HTTPGet(uri, callbackFunction, callbackParameter) { var xmlHttp = new XMLHttpRequest(); @@ -81,8 +83,9 @@ function HTTPPost(uri, callbackFunction, callbackParameter, object) { var toSend = ''; if (typeof object == 'object') { xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); - for (var i in object) - toSend += (toSend ? '&' : '') + i + '=' + escape(object[i]); + for (var i in object) { + toSend += (toSend ? '&' : '') + i + '=' + encodeURIComponent(object[i]); + } } else { toSend = object; diff --git a/misc/upload.js b/misc/upload.js index 89f7cfb69e7..9945803f6b4 100644 --- a/misc/upload.js +++ b/misc/upload.js @@ -39,7 +39,7 @@ jsUpload.prototype.onsubmit = function () { var hide = $(this.hide); // Insert progressbar and stretch to take the same space. this.progress = new progressBar('uploadprogress'); - this.progress.setProgress(-1, 'Uploading file...'); + this.progress.setProgress(-1, 'Uploading file'); this.progress.element.style.width = '28em'; this.progress.element.style.height = hide.offsetHeight +'px'; hide.parentNode.insertBefore(this.progress.element, hide);