File tree 1 file changed +7
-6
lines changed
compiler/src/dotty/tools/dotc/rewrites
1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,9 @@ import collection.mutable
8
8
import scala .annotation .tailrec
9
9
import dotty .tools .dotc .reporting .Reporter
10
10
11
+ import java .io .OutputStreamWriter
12
+ import java .nio .charset .StandardCharsets .UTF_8
13
+
11
14
/** Handles rewriting of Scala2 files to Dotty */
12
15
object Rewrites {
13
16
private class PatchedFiles extends mutable.HashMap [SourceFile , Patches ]
@@ -54,13 +57,11 @@ object Rewrites {
54
57
ds
55
58
}
56
59
57
- def writeBack (): Unit = {
60
+ def writeBack (): Unit =
58
61
val chars = apply(source.underlying.content)
59
- val bytes = new String (chars).getBytes
60
- val out = source.file.output
61
- out.write(bytes)
62
- out.close()
63
- }
62
+ val osw = OutputStreamWriter (source.file.output, UTF_8 )
63
+ try osw.write(chars, 0 , chars.length)
64
+ finally osw.close()
64
65
}
65
66
66
67
/** If -rewrite is set, record a patch that replaces the range
You can’t perform that action at this time.
0 commit comments