Chromium Code Reviews| Index: sdk/lib/uri/encode_decode.dart |
| diff --git a/sdk/lib/uri/encode_decode.dart b/sdk/lib/uri/encode_decode.dart |
| index e6270a8c99d97fba238e2a88a7a73cc204eb0449..dd84fc2bfbb0c816e472fbe602637cc7049157e0 100644 |
| --- a/sdk/lib/uri/encode_decode.dart |
| +++ b/sdk/lib/uri/encode_decode.dart |
| @@ -22,7 +22,7 @@ part of dart.uri; |
| */ |
| String encodeUri(String uri) { |
| return _uriEncode( |
| - "-_.!~*'()#;,/?:@&=+\$0123456789" |
| + "-_.!~*'()#;,/?:@&=\$0123456789" |
| "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", uri); |
| } |
| @@ -82,6 +82,8 @@ String _uriEncode(String canonical, String text) { |
| for (int i = 0; i < text.length; i++) { |
| if (canonical.indexOf(text[i]) >= 0) { |
|
Lasse Reichstein Nielsen
2012/12/20 23:24:32
Ick, that looks slow - indexOf is linear in the ca
Søren Gjesse
2012/12/21 08:51:19
Created a new change to address this.
|
| result.add(text[i]); |
| + } else if (text[i] == " ") { |
| + result.add("+"); |
| } else { |
| int ch = text.charCodeAt(i); |
| if (ch >= 0xD800 && ch < 0xDC00) { |
| @@ -128,7 +130,11 @@ String _uriDecode(String text) { |
| for (int i = 0; i < text.length;) { |
| String ch = text[i]; |
| if (ch != '%') { |
| - result.add(ch); |
| + if (ch == '+') { |
| + result.add(" "); |
| + } else { |
| + result.add(ch); |
| + } |
| i++; |
| } else { |
| codepoints.clear(); |