Permalink
Browse files

Fixes avm1 loadVariables trace test

  • Loading branch information...
1 parent 8047a5f commit 08c3804f640b19f34016e77b0a18485a1a5e8f78 @yurydelendik yurydelendik committed Feb 28, 2014
Showing with 10 additions and 4 deletions.
  1. +10 −4 src/flash/net/URLVariables.as
@@ -33,8 +33,8 @@ public dynamic class URLVariables {
Error.throwError(Error, 2101); // Errors.DecodeParamError
return;
}
- var name: String = unescapeMultiByte(p.substring(0, j));
- var value: String = unescapeMultiByte(p.substring(j + 1));
+ var name: String = unescape(p.substring(0, j));
+ var value: String = unescape(p.substring(j + 1));
if (typeof this[name] == 'undefined') {
this[name] = value;
} else if (this[name] is Array) {
@@ -49,13 +49,19 @@ public dynamic class URLVariables {
for (var name: String in this) {
if (this[name] is Array) {
for each (var value:String in this[name]) {
- pairs.push(escapeMultiByte(name) + '=' + escapeMultiByte(value));
+ pairs.push(escape(name) + '=' + escape(value));
}
} else {
- pairs.push(escapeMultiByte(name) + '=' + escapeMultiByte(this[name]));
+ pairs.push(escape(name) + '=' + escape(this[name]));
}
}
return pairs.join('&');
}
+ private function unescape(s: String): String {
+ return s && unescapeMultiByte(s.split('+').join(' '));
+ }
+ private function escape(s: String): String {
+ return s && escapeMultiByte(s).split(' ').join('+');
+ }
}
}

0 comments on commit 08c3804

Please sign in to comment.