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

Unified Diff: lib/src/io.dart

Issue 1248483003: Write binstubs using the system encoding. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « lib/src/global_packages.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/io.dart
diff --git a/lib/src/io.dart b/lib/src/io.dart
index 2ec22ffc0d1c49cb0cd276fc7d9966ce4a1f6123..8b7fc17cdf73621c2aa9c22438448f9faa3b030d 100644
--- a/lib/src/io.dart
+++ b/lib/src/io.dart
@@ -165,14 +165,16 @@ List<int> readBinaryFile(String file) {
///
/// If [dontLogContents] is true, the contents of the file will never be logged.
String writeTextFile(String file, String contents,
- {bool dontLogContents: false}) {
+ {bool dontLogContents: false, Encoding encoding}) {
+ if (encoding == null) encoding = UTF8;
+
// Sanity check: don't spew a huge file.
log.io("Writing ${contents.length} characters to text file $file.");
if (!dontLogContents && contents.length < 1024 * 1024) {
log.fine("Contents:\n$contents");
}
- new File(file).writeAsStringSync(contents);
+ new File(file).writeAsStringSync(contents, encoding: encoding);
return file;
}
« no previous file with comments | « lib/src/global_packages.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698