Printing Unicode from Scala interpreter

后端 未结 3 1977
慢半拍i
慢半拍i 2020-12-10 01:31

When using the scala interpreter (i.e. running the command \'scala\' on the commandline), I am not able to print unicode characters correctly. Of course a-z, A-Z, etc. are p

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-10 02:10

    For Windows in command line (cmd) print:

    1. set JAVA_OPTS="-Dfile.encoding=UTF-8"
    2. chcp 65001

    Item 2 means UTF-8

    If you don't want everytime print "chcp 65001", you can change/add value in Windows Registry like this:

    1. Run command regedit
    2. find record [HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
    3. New => String value
    4. Name = "AutoRun", Data = "chcp 65001" (without quotes)

    (see https://superuser.com/a/482117/454417)

    I use Windows 10 and scala 2.11.8

提交回复
热议问题