Index: sdk/lib/_internal/pub_generated/lib/src/validator/utf8_readme.dart |
diff --git a/sdk/lib/_internal/pub_generated/lib/src/validator/utf8_readme.dart b/sdk/lib/_internal/pub_generated/lib/src/validator/utf8_readme.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2f81ba5729b5cf2641ab369f8c1d46de5ef19152 |
--- /dev/null |
+++ b/sdk/lib/_internal/pub_generated/lib/src/validator/utf8_readme.dart |
@@ -0,0 +1,24 @@ |
+library pub.validator.utf8_readme; |
+import 'dart:async'; |
+import 'dart:convert'; |
+import '../entrypoint.dart'; |
+import '../io.dart'; |
+import '../utils.dart'; |
+import '../validator.dart'; |
+class Utf8ReadmeValidator extends Validator { |
+ Utf8ReadmeValidator(Entrypoint entrypoint) : super(entrypoint); |
+ Future validate() { |
+ return syncFuture(() { |
+ var readme = entrypoint.root.readmePath; |
+ if (readme == null) return; |
+ var bytes = readBinaryFile(readme); |
+ try { |
+ 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."); |
+ } |
+ }); |
+ } |
+} |