[scala] A character encoding problem when using scala interactive interpreter
Hello.
I wrote the following code and saved it as 'hello.scala' in UTF-8.
object こんにちは {// "こんにちは" means "hello" in English.
def main(args: Array[String]) {
println("hello, world")
}
}
This file is successfully compiled by scalac(scala2.7.1.final on
Windows XP Service Pack 2).
> scalac hello.scala
But it is failed to load this file by ":load" command in scala
interactive interpreter(on cmd.exe).
> scala
Welcome to Scala version 2.7.1.final (Java HotSpot(TM) Client VM, Java 1.6.0).
Type in expressions to have them evaluated.
Type :help for more information.
scala> :load hello.scala
Loading hello.scala...
<console>:1: error: illegal character: '。'
object 縺薙s縺ォ縺。縺ッ {
^
main: (Array[String])Unit
It is successful to load this file if I save it in Windows-31J. It seems that
":load" command processes a file in the platform default encoding. I think
that ":load" command should process a file in the same encoding as specified
by -encoding option(or UTF-8 if the encoding is not specified).