Skip to content

Commit 76f5ff3

Browse files
author
Martijn Hoekstra
committed
force UTF-8 for slurp and write
1 parent 87e24e7 commit 76f5ff3

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

test/test/CompilerTest.scala

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,18 @@ abstract class CompilerTest {
452452
processFileDir(sourceFile, { sf =>
453453
if (extensionsToCopy.contains(sf.extension)) {
454454
dest.parent.jfile.mkdirs
455-
dest.toFile.writeAll(s"/* !!!!! WARNING: DO NOT MODIFY. Original is at: $sf !!!!! */", sf.slurp)
455+
try {
456+
scala.reflect.io.File(dest)(scala.io.Codec.UTF8).writeAll(s"/* !!!!! WARNING: DO NOT MODIFY. Original is at: $sf !!!!! */", sf.slurp("UTF-8"))
457+
} catch {
458+
case unmappable: java.nio.charset.UnmappableCharacterException => {
459+
log(s"ERROR: reading file $sf failed to decode: $unmappable")
460+
throw unmappable
461+
}
462+
case t: Throwable => {
463+
log(s"ERROR: file $sf failed for some other reason: $t")
464+
throw t
465+
}
466+
}
456467
} else {
457468
log(s"WARNING: ignoring $sf")
458469
}

0 commit comments

Comments
 (0)