Reputation: 353
For example, I observe the following behavior:
Welcome to Scala 2.11.12 (Java HotSpot(TM) 64-Bit Server VM, Java 12.0.1).
Type in expressions for evaluation. Or try :help.
scala> print("hi!")
hi!
scala> print("γεια!")
????!
How can I fix this?
when setting the file.encoding
to UTF-8
I get:
scala> sys.props("file.encoding")
res0: String = UTF-8
scala> print("γεια!")
????!
scala>
Upvotes: 2
Views: 833
Reputation: 48430
Check if the file.encoding
is set to UTF-8
by running Scala Console
and evaluate
sys.props("file.encoding")
If it does not return
res0: String = UTF-8
then stop and edit Scala Console
run configuration. Under VM Options
input field enter Unicode file encoding like so
-Dfile.encoding=UTF-8
Now rerun Scala Console
run configuration, re-evaluate sys.props("file.encoding")
to make sure it says UTF-8
, and then try print("γεια!")
which should now output
scala> print("γεια!")
γεια!
Upvotes: 2
Reputation: 1212
The point is that run/debug console uses the IDEA encoding. IDEA is a java application and encoding can be set in the idea.exe.vmoptions file as ordinary VM parameter. This file lies near your IDEA executabe file and conteins a set of JVM parameters. Add -Dfile.encoding=UTF-8 there to set encoding in UTF-8.
Upvotes: 2