aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Groner2011-09-02 16:28:52 -0400
committerVojta Jina2011-09-08 23:00:59 +0200
commit7e1f364177111ba6cceac82f6c6bcc254448292b (patch)
treee79b08bc1762dcfbed6bd58b7276173df45d9867
parentaac68bf2ba2dcdf0b22fa4f15ea49672cb06328d (diff)
downloadangular.js-7e1f364177111ba6cceac82f6c6bcc254448292b.tar.bz2
fix($location): Use encodeUriQuery instead of escape
Closes #492
-rw-r--r--src/Angular.js6
-rw-r--r--src/service/location.js2
2 files changed, 4 insertions, 4 deletions
diff --git a/src/Angular.js b/src/Angular.js
index d5d862e0..49a30c07 100644
--- a/src/Angular.js
+++ b/src/Angular.js
@@ -859,8 +859,8 @@ function parseKeyValue(/**string*/keyValue) {
forEach((keyValue || "").split('&'), function(keyValue){
if (keyValue) {
key_value = keyValue.split('=');
- key = unescape(key_value[0]);
- obj[key] = isDefined(key_value[1]) ? unescape(key_value[1]) : true;
+ key = decodeURIComponent(key_value[0]);
+ obj[key] = isDefined(key_value[1]) ? decodeURIComponent(key_value[1]) : true;
}
});
return obj;
@@ -869,7 +869,7 @@ function parseKeyValue(/**string*/keyValue) {
function toKeyValue(obj) {
var parts = [];
forEach(obj, function(value, key) {
- parts.push(escape(key) + (value === true ? '' : '=' + escape(value)));
+ parts.push(encodeUriQuery(key, true) + (value === true ? '' : '=' + encodeUriQuery(value, true)));
});
return parts.length ? parts.join('&') : '';
}
diff --git a/src/service/location.js b/src/service/location.js
index 9a1afc37..644b4aaa 100644
--- a/src/service/location.js
+++ b/src/service/location.js
@@ -331,7 +331,7 @@ LocationUrl.prototype = LocationHashbangUrl.prototype = {
if (paramValue === null) {
delete this.$$search[search];
} else {
- this.$$search[search] = escape(paramValue);
+ this.$$search[search] = encodeUriQuery(paramValue);
}
} else {
this.$$search = isString(search) ? parseKeyValue(search) : search;