Don't percent-encode digits.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b159928..984a0ee 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,8 @@
+## 2.0.1
+
+* `PercentEncoder` no longer encodes digits. This follows the specified
+ behavior.
+
## 2.0.0
**Note**: No new APIs have been added in 2.0.0. Packages that would use 2.0.0 as
diff --git a/lib/src/percent/encoder.dart b/lib/src/percent/encoder.dart
index c781760..790caff 100644
--- a/lib/src/percent/encoder.dart
+++ b/lib/src/percent/encoder.dart
@@ -67,6 +67,7 @@
// that that bit is 1 we ensure that the letter is lowercase.
var letter = 0x20 | byte;
if ((letter >= $a && letter <= $z) ||
+ (byte >= $0 && byte <= $9) ||
byte == $dash ||
byte == $dot ||
byte == $underscore ||
diff --git a/pubspec.yaml b/pubspec.yaml
index e9d38be..e442f97 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: convert
-version: 2.0.0
+version: 2.0.1
description: Utilities for converting between data representations.
author: Dart Team <misc@dartlang.org>
homepage: https://github.com/dart-lang/convert
diff --git a/test/percent_test.dart b/test/percent_test.dart
index 7a1daca..a4a6fb7 100644
--- a/test/percent_test.dart
+++ b/test/percent_test.dart
@@ -14,9 +14,9 @@
expect(percent.encode([
$a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p, $q, $r,
$s, $t, $u, $v, $w, $x, $y, $z, $A, $B, $C, $D, $E, $F, $G, $H, $I, $J,
- $K, $L, $M, $N, $O, $P, $Q, $R, $S, $T, $U, $V, $W, $X, $Y, $Z, $dash,
- $dot, $underscore, $tilde
- ]), equals("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-._~"));
+ $K, $L, $M, $N, $O, $P, $Q, $R, $S, $T, $U, $V, $W, $X, $Y, $Z, $0, $1,
+ $2, $3, $4, $5, $6, $7, $8, $9, $dash, $dot, $underscore, $tilde
+ ]), equals("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~"));
});
test("percent-encodes reserved ASCII characters", () {
@@ -77,8 +77,8 @@
group("decoder", () {
test("converts percent-encoded strings to byte arrays", () {
- expect(percent.decode("a%2Bb%3D%80"),
- equals([$a, $plus, $b, $equal, 0x80]));
+ expect(percent.decode("a%2Bb%3D%801"),
+ equals([$a, $plus, $b, $equal, 0x80, $1]));
});
test("supports lowercase letters", () {
@@ -108,12 +108,12 @@
});
test("converts percent to byte arrays", () {
- sink.add("a%2Bb%3D%80");
- expect(results, equals([[$a, $plus, $b, $equal, 0x80]]));
+ sink.add("a%2Bb%3D%801");
+ expect(results, equals([[$a, $plus, $b, $equal, 0x80, $1]]));
sink.add("%00%01%FE%FF");
expect(results,
- equals([[$a, $plus, $b, $equal, 0x80], [0x00, 0x01, 0xfe, 0xff]]));
+ equals([[$a, $plus, $b, $equal, 0x80, $1], [0x00, 0x01, 0xfe, 0xff]]));
});
test("supports trailing percents and digits split across chunks", () {