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

Side by Side Diff: sdk/lib/codec/encoding.dart

Issue 19000006: First version of Codecs and Converters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revert sdk/lib/json change. Created 7 years, 5 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013, 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 part of dart.codec;
6
7 /**
8 * Open-ended Encoding enum.
9 */
10 // TODO(floitsch): dart:io already has an Encoding class. If we can't
11 // consolitate them, we need to remove `Encoding` here.
12 // TODO(floitsch): add other encodings, like ASCII and ISO_8859_1.
Lasse Reichstein Nielsen 2013/07/12 11:50:47 These are partial encodings of strings (where stri
floitsch 2013/07/12 16:09:15 If we intend to replace the Encoding enum in dart:
13 abstract class Encoding extends Codec<String, List<int>> {
14 const Encoding();
15
16 static const UTF8 = const Utf8Codec();
Lasse Reichstein Nielsen 2013/07/12 11:50:47 Put this outside the class. Since it's an open-end
floitsch 2013/07/12 16:09:15 Done.
17 }
18
19 /**
20 * A [Utf8Codec] encodes strings to utf-8 codeunits (bytes) and decodes
Lasse Reichstein Nielsen 2013/07/12 11:50:47 codeunits -> code units
floitsch 2013/07/12 16:09:15 Done.
21 * utf-8 codeunits to strings.
Lasse Reichstein Nielsen 2013/07/12 11:50:47 utf-8 -> UTF-8 codeunits -> code units
floitsch 2013/07/12 16:09:15 Done.
22 */
23 // TODO(floitsch): Needs a way to specify a replacement character for decoding.
Lasse Reichstein Nielsen 2013/07/12 11:50:47 Default replacement character is U+FFFD (aka. REPL
floitsch 2013/07/12 16:09:15 Changed comment.
24 class Utf8Codec extends Encoding {
25 const Utf8Codec();
26
27 Converter<String, List<int>> get encoder => new Utf8Encoder();
28 Converter<List<int>, String> get decoder => new Utf8Decoder();
29 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698