Scala, Windows CMD, Simple Build Tools, Unicode

In order to see Unicode characters when running a Scala project using SBT inside a Windows console (cmd) you have to perform the following steps:

  • Fire up regedit and navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ Console\TrueTypeFont. There should be an entry with key-value pair (“0″, “Lucida Console”). Add new pairs with a sequence of zeros as the key and a font as the value, e.g. (“00″, “DejaVu Sans”), (“000″, “Lucida Sans Typewriter”) etc.
  • Edit your SBT launcher-script – the one that runs SBT e.g. as java %SBT_OPTS% -Xmx256M -jar "tools/sbt-launch-0.7.4.jar" %* and add the Java option -Dfile.encoding=UTF-8.
  • Open a Windows command box and run chcp 65001 to set the code page to UTF-8.

That’s it. You should now be able to see Unicode output of your Scala project when run from inside the SBT shell.

If you want to change the code page permanently, run regedit, go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage and change the “OEMCP” value to “65001″.

One Response to 'Scala, Windows CMD, Simple Build Tools, Unicode'

  1. Tillmann Rendel says:

    I’m using SBT 0.12.4, and adapted the second step as follows: Instead of editing `sbt.bat` I added the option to `sbtconfig.txt` in the same directory. Thanks for the this info, it got me looking into the right direction.

Leave a Reply

Your email address will not be published. Required fields are marked *

*