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

Unified Diff: sdk/lib/_internal/pub/lib/src/validator/utf8_readme.dart

Issue 22909059: Some more removals of dart:utf. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Change ArgumentError to FormatException. 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
Index: sdk/lib/_internal/pub/lib/src/validator/utf8_readme.dart
diff --git a/sdk/lib/_internal/pub/lib/src/validator/utf8_readme.dart b/sdk/lib/_internal/pub/lib/src/validator/utf8_readme.dart
index 28cccbda67abc7ad4ffa8d0e5ceaaf1440c3a685..9f30d65599d7668fecd5c13806edeb3d5c30742e 100644
--- a/sdk/lib/_internal/pub/lib/src/validator/utf8_readme.dart
+++ b/sdk/lib/_internal/pub/lib/src/validator/utf8_readme.dart
@@ -5,7 +5,7 @@
library pub.validator.utf8_readme;
import 'dart:async';
-import 'dart:utf';
+import 'dart:convert';
import '../entrypoint.dart';
import '../io.dart';
@@ -22,11 +22,9 @@ class Utf8ReadmeValidator extends Validator {
if (readme == null) return;
var bytes = readBinaryFile(readme);
try {
- // The second and third arguments here are the default values. The
- // fourth tells [decodeUtf8] to throw an ArgumentError if `bytes` isn't
- // valid utf-8.
- decodeUtf8(bytes, 0, null, null);
- } on ArgumentError catch (_) {
+ // UTF8.decode doesn't allow invalid UTF-8.
+ UTF8.decode(bytes);
+ } on FormatException catch (_) {
warnings.add("$readme contains invalid UTF-8.\n"
"This will cause it to be displayed incorrectly on "
"pub.dartlang.org.");

Powered by Google App Engine
This is Rietveld 408576698