OLD | NEW |
---|---|
(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.convert; | |
6 | |
7 /** | |
8 * A [Utf8Encoder] converts strings to their utf-8 code units (a list of | |
Lasse Reichstein Nielsen
2013/07/12 11:50:47
utf -> UTF
floitsch
2013/07/12 16:09:15
Done.
| |
9 * 8-bit integers). | |
Lasse Reichstein Nielsen
2013/07/12 11:50:47
unsigned 8-bit integers,
or just integer in the ra
floitsch
2013/07/12 16:09:15
Done.
| |
10 */ | |
11 class Utf8Encoder extends Converter<String, List<int>> { | |
12 /** | |
13 * Converts [str] to its utf-8 code units (a list of | |
Lasse Reichstein Nielsen
2013/07/12 11:50:47
str -> string
utf-8 -> UTF-8
floitsch
2013/07/12 16:09:15
Done.
| |
14 * 8-bit integers). | |
15 */ | |
16 List<int> convert(String str) => OLD_UTF_LIB.encodeUtf8(str); | |
17 } | |
18 | |
19 /** | |
20 * A [Utf8Decoder] converts utf-8 code units (lists of 8-bit ints) to strings. | |
Lasse Reichstein Nielsen
2013/07/12 11:50:47
UTF-8
unsigned
"to a string"
floitsch
2013/07/12 16:09:15
Done.
| |
21 */ | |
22 class Utf8Decoder extends Converter<List<int>, String> { | |
23 /** | |
24 * Converts the utf-8 [codeUnits] (a list of 8-bit integers) to the | |
Lasse Reichstein Nielsen
2013/07/12 11:50:47
ditto
floitsch
2013/07/12 16:09:15
Done.
| |
25 * corresponding string. | |
26 */ | |
27 // TODO(floitsch): allow to configure the decoder (for example the replacement | |
28 // character). | |
29 String convert(List<int> codeUnits) => OLD_UTF_LIB.decodeUtf8(codeUnits); | |
30 } | |
OLD | NEW |