OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 library convert.percent; | |
6 | |
7 import 'dart:convert'; | |
8 | |
9 import 'percent/encoder.dart'; | |
10 import 'percent/decoder.dart'; | |
11 | |
12 export 'percent/encoder.dart' hide percentEncoder; | |
13 export 'percent/decoder.dart' hide percentDecoder; | |
14 | |
15 /// The canonical instance of [PercentCodec]. | |
16 const percent = const PercentCodec._(); | |
17 | |
18 // TODO(nweiz): Add flags to support generating and interpreting "+" as a space | |
19 // character. | |
Lasse Reichstein Nielsen
2015/10/08 10:30:36
That's not plain percent-encoding. It's www-form-u
| |
20 /// A codec that converts byte arrays to and from percent-encoded (also known as | |
21 /// URL-encoded) strings according to [RFC 3986][rfc]. | |
22 /// | |
23 /// [rfc]: https://tools.ietf.org/html/rfc3986#section-2.1 | |
24 /// | |
25 /// [encoder] encodes all bytes other than ASCII letters, decimal digits, or one | |
26 /// of `-._~`. This matches the behavior of [Uri.encodeQueryComponent] except | |
27 /// that it doesn't encode `0x20` bytes to the `+` character. | |
28 /// | |
29 /// To be maximally flexible, [decoder] will decode any percent-encoded byte and | |
30 /// will allow any non-percent-encoded byte other than `%`. By default, it | |
31 /// interprets `+` as `0x2B` rather than `0x20` as emitted by | |
32 /// [Uri.encodeQueryComponent]. | |
33 class PercentCodec extends Codec<List<int>, String> { | |
34 PercentEncoder get encoder => percentEncoder; | |
35 PercentDecoder get decoder => percentDecoder; | |
36 | |
37 const PercentCodec._(); | |
38 } | |
OLD | NEW |