Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(452)

Side by Side Diff: lib/src/percent.dart

Issue 1393003003: Add a percent-encoding converter. (Closed) Base URL: git@github.com:dart-lang/convert.git@master
Patch Set: Code review changes Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/src/hex/encoder.dart ('k') | lib/src/percent/decoder.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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. Also add an option for custom sets of unreserved characters.
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 }
OLDNEW
« no previous file with comments | « lib/src/hex/encoder.dart ('k') | lib/src/percent/decoder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698