Easy Tutorial
❮ View Ssh Public Key Python One And Two Star ❯

Solving Chinese Character Garbled Issues in Scala

Category Programming Techniques

When compiling Scala code on Scala version 2.11.7 with Mac OS X or Linux systems, if Chinese characters appear, garbled text may occur.

The solution is as follows: edit the following two execution scripts respectively:

$ vim `which scala`

$ vim `which scalac`

Find:

[ -n "$JAVA_OPTS" ] || JAVA_OPTS="-Xmx256M -Xms32M"

Replace it with:

[ -n "$JAVA_OPTS" ] || JAVA_OPTS="-Xmx256M -Xms32M -Dfile.encoding=UTF-8"

Recompile the scripts, and Chinese characters will be displayed correctly.

** Click to Share Notes

Cancel

-

-

-

❮ View Ssh Public Key Python One And Two Star ❯