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

Unified Diff: pkg/http/lib/src/utils.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 | « pkg/http/lib/src/response.dart ('k') | pkg/http/test/request_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/http/lib/src/utils.dart
diff --git a/pkg/http/lib/src/utils.dart b/pkg/http/lib/src/utils.dart
index 420a3d55441a7ffe25e8188a45db378cdff1dc3c..cf2096d74dfae22562b2885528cf4356dc7f3fd2 100644
--- a/pkg/http/lib/src/utils.dart
+++ b/pkg/http/lib/src/utils.dart
@@ -5,9 +5,9 @@
library utils;
import 'dart:async';
+import 'dart:convert';
import 'dart:io';
import 'dart:typed_data';
-import 'dart:utf';
import 'byte_stream.dart';
@@ -66,9 +66,9 @@ List<String> split1(String toSplit, String pattern) {
/// [charset] is null or if no [Encoding] was found that corresponds to
/// [charset].
Encoding encodingForCharset(
- String charset, [Encoding fallback = Encoding.ISO_8859_1]) {
+ String charset, [Encoding fallback = LATIN1]) {
if (charset == null) return fallback;
- var encoding = Encoding.fromName(charset);
+ var encoding = Encoding.getByName(charset);
return encoding == null ? fallback : encoding;
}
@@ -77,23 +77,11 @@ Encoding encodingForCharset(
/// [FormatException] if no [Encoding] was found that corresponds to [charset].
/// [charset] may not be null.
Encoding requiredEncodingForCharset(String charset) {
- var encoding = Encoding.fromName(charset);
+ var encoding = Encoding.getByName(charset);
if (encoding != null) return encoding;
throw new FormatException('Unsupported encoding "$charset".');
}
-/// Converts [bytes] into a [String] according to [encoding].
-String decodeString(List<int> bytes, Encoding encoding) {
- // TODO(nweiz): implement this once issue 6284 is fixed.
- return decodeUtf8(bytes);
-}
-
-/// Converts [string] into a byte array according to [encoding].
-List<int> encodeString(String string, Encoding encoding) {
- // TODO(nweiz): implement this once issue 6284 is fixed.
- return encodeUtf8(string);
-}
-
/// A regular expression that matches strings that are composed entirely of
/// ASCII-compatible characters.
final RegExp _ASCII_ONLY = new RegExp(r"^[\x00-\x7F]+$");
« no previous file with comments | « pkg/http/lib/src/response.dart ('k') | pkg/http/test/request_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698