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; |
} |