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

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

Issue 11368138: Add some support for the code-point code-unit distinction. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Implemented feedback from patch set 3 Created 8 years, 1 month 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
Index: sdk/lib/utf/utf8.dart
diff --git a/sdk/lib/utf/utf8.dart b/sdk/lib/utf/utf8.dart
index 48933af99f435572079a9a0a79e49397b5111d69..8cc072752b79acb2d579f1460d0b75948022cbb1 100644
--- a/sdk/lib/utf/utf8.dart
+++ b/sdk/lib/utf/utf8.dart
@@ -41,7 +41,7 @@ IterableUtf8Decoder decodeUtf8AsIterable(List<int> bytes, [int offset = 0,
*/
String decodeUtf8(List<int> bytes, [int offset = 0, int length,
int replacementCodepoint = UNICODE_REPLACEMENT_CHARACTER_CODEPOINT]) {
- return codepointsToString(
+ return new String.fromCharCodes(
(new Utf8Decoder(bytes, offset, length, replacementCodepoint))
.decodeRest());
}
@@ -50,7 +50,7 @@ String decodeUtf8(List<int> bytes, [int offset = 0, int length,
* Produce a sequence of UTF-8 encoded bytes from the provided string.
*/
List<int> encodeUtf8(String str) =>
- codepointsToUtf8(stringToCodepoints(str));
+ codepointsToUtf8(str.charCodes);
int _addToEncoding(int offset, int bytes, int value, List<int> buffer) {
while (bytes > 0) {
« runtime/vm/unicode.h ('K') | « sdk/lib/utf/utf32.dart ('k') | sdk/lib/utf/utf_core.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698