| Index: sdk/lib/core/uri.dart
|
| diff --git a/sdk/lib/core/uri.dart b/sdk/lib/core/uri.dart
|
| index 10aa827cb190c6e93a8889cad67312629145d5f5..3c458358d690fe9bf723fd914764e049efde4d85 100644
|
| --- a/sdk/lib/core/uri.dart
|
| +++ b/sdk/lib/core/uri.dart
|
| @@ -2260,6 +2260,8 @@ class Uri {
|
| String text,
|
| {Encoding encoding: UTF8,
|
| bool spaceToPlus: false}) {
|
| + if (_noUriEncodingNeeded(canonicalTable, text, encoding)) return text;
|
| +
|
| byteToHex(byte, buffer) {
|
| const String hex = '0123456789ABCDEF';
|
| buffer.writeCharCode(hex.codeUnitAt(byte >> 4));
|
| @@ -2285,6 +2287,17 @@ class Uri {
|
| return result.toString();
|
| }
|
|
|
| + static bool _noUriEncodingNeeded(
|
| + List<int> canonicalTable, String text, Encoding encoding) {
|
| + if (encoding != UTF8) return false;
|
| + for (int i = 0; i < text.length; i++) {
|
| + int code = text.codeUnitAt(i);
|
| + if (code >= 128) return false;
|
| + if ((canonicalTable[code >> 4] & (1 << (code & 0x0f))) == 0) return false;
|
| + }
|
| + return true;
|
| + }
|
| +
|
| /**
|
| * Convert a byte (2 character hex sequence) in string [s] starting
|
| * at position [pos] to its ordinal value
|
|
|