Chromium Code Reviews| Index: pkg/http/lib/src/utils.dart |
| diff --git a/pkg/http/lib/src/utils.dart b/pkg/http/lib/src/utils.dart |
| index 65c47997b1e6991c5cf460fe4ae8659432901262..3815475893f3adf7e25ed2f3f11fe5ed405cc447 100644 |
| --- a/pkg/http/lib/src/utils.dart |
| +++ b/pkg/http/lib/src/utils.dart |
| @@ -78,30 +78,10 @@ List<String> split1(String toSplit, String pattern) { |
| Encoding encodingForCharset( |
| String charset, [Encoding fallback = Encoding.ISO_8859_1]) { |
| if (charset == null) return fallback; |
| - var encoding = _encodingForCharset(charset); |
| + var encoding = Encoding.fromName(charset); |
| return encoding == null ? fallback : encoding; |
| } |
| -/// Returns the [Encoding] that corresponds to [charset]. Throws a |
| -/// [FormatException] if no [Encoding] was found that corresponds to [charset]. |
| -/// [charset] may not be null. |
| -Encoding requiredEncodingForCharset(String charset) { |
|
nweiz
2013/03/07 19:32:05
Now I'm concerned that there are cases where [requ
Søren Gjesse
2013/03/08 09:47:46
Done.
|
| - var encoding = _encodingForCharset(charset); |
| - if (encoding != null) return encoding; |
| - throw new FormatException('Unsupported encoding "$charset".'); |
| -} |
| - |
| -/// Returns the [Encoding] that corresponds to [charset]. Returns null if no |
| -/// [Encoding] was found that corresponds to [charset]. [charset] may not be |
| -/// null. |
| -Encoding _encodingForCharset(String charset) { |
| - charset = charset.toLowerCase(); |
| - if (charset == 'ascii' || charset == 'us-ascii') return Encoding.ASCII; |
| - if (charset == 'utf-8') return Encoding.UTF_8; |
| - if (charset == 'iso-8859-1') return Encoding.ISO_8859_1; |
| - return null; |
| -} |
| - |
| /// Converts [bytes] into a [String] according to [encoding]. |
| String decodeString(List<int> bytes, Encoding encoding) { |
| // TODO(nweiz): implement this once issue 6284 is fixed. |