Whats wrong with Scala encoding?

I guess something is wrong with Scala while displaying "\303\251" unicode. Ideally it should display "é" but instead it is displaying "é".

I tried with several scala versions like 2.10.4, 2.10.5 & 2.11.8 but i got the same output (i.e., é).

$ JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8 sbt
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
> console
Welcome to Scala version 2.11.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_71).
scala> print ("\303\251")
scala> System.getProperty("file.encoding");
res2: String = UTF8

even i used equivalent hex escape literals for \303\251 i.e., \u00c3\u00a9, still the same output

scala> print ("\u00c3\u00a9")

Note: I face this issue only in Linux and Ubuntu OS but in MAC it works very fine as shown below:

scala> print ("\303\251")

I didn't understand why scala is giving wrong output in linux & ubuntu machines. Does anyone faced this issue? Please let me know how to fix this. Thanks for your time and help.


Yes, Linux character encoding is the issue. After changing the environment variable LANG (as shown below), everything works properly.

/usr/bin/env LANG=en_US.UTF-8 /usr/bin/xterm

Need Your Help

Bitmap OutOfMemory on Multiple Screen Changes

android memory-leaks

I have a bitmap that I load from the SD card by allowing the user to choose a picture to display. Once the bitmap is created, I set the Bitmap in an ImageView:

XPages and EL concat

xpages el concat

I am trying to implement the example at http://lpar.ath0.com/2014/04/07/repeated-xpages-input-controls-with-number-indexed-field-names/