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

Unified Diff: sdk/lib/convert/utf.dart

Issue 22872012: Remove Encoding-enum from dart:io and add interface in dart:convert. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix typo. Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/convert/latin1.dart ('k') | sdk/lib/io/file.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/convert/utf.dart
diff --git a/sdk/lib/convert/utf.dart b/sdk/lib/convert/utf.dart
index 37f2335252934ebf2d8f30ef37c549217059d603..6abaa0519b959200fe49ec33d7df190bd23fc352 100644
--- a/sdk/lib/convert/utf.dart
+++ b/sdk/lib/convert/utf.dart
@@ -4,6 +4,9 @@
part of dart.convert;
+/** The Unicode Replacement character `U+FFFD` (�). */
+const UNICODE_REPLACEMENT_CHARACTER_RUNE = 0xFFFD;
+
/**
* An instance of the default implementation of the [Utf8Codec].
*
@@ -22,7 +25,7 @@ const UTF8 = const Utf8Codec();
* A [Utf8Codec] encodes strings to utf-8 code units (bytes) and decodes
* UTF-8 code units to strings.
*/
-class Utf8Codec extends _Encoding {
+class Utf8Codec extends Encoding {
final bool _allowMalformed;
/**
@@ -39,6 +42,8 @@ class Utf8Codec extends _Encoding {
const Utf8Codec({ bool allowMalformed: false })
: _allowMalformed = allowMalformed;
+ String get name => "utf-8";
+
/**
* Decodes the UTF-8 [codeUnits] (a list of unsigned 8-bit integers) to the
* corresponding string.
@@ -66,6 +71,9 @@ class Utf8Codec extends _Encoding {
* unsigned 8-bit integers).
*/
class Utf8Encoder extends Converter<String, List<int>> {
+
+ const Utf8Encoder();
+
/**
* Converts [string] to its UTF-8 code units (a list of
* unsigned 8-bit integers).
@@ -289,7 +297,7 @@ class Utf8Decoder extends Converter<List<int>, String> {
* sequences with the Unicode Replacement character `U+FFFD` (�). Otherwise
* it throws a [FormatException].
*/
- Utf8Decoder({ bool allowMalformed: false })
+ const Utf8Decoder({ bool allowMalformed: false })
: this._allowMalformed = allowMalformed;
/**
« no previous file with comments | « sdk/lib/convert/latin1.dart ('k') | sdk/lib/io/file.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698