I just started fighting my way up the learning curve with Scala. I generally do this sort of thing by implementing the first twenty or so Euler problems. Things took a surprising turn when I hit #4.
/*
A palindromic number reads the same both ways.
The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-digit numbers.
*/
object Four
{
def main(args: Array[String])
{
println("start");
println("end");
}
}
Although it might not jump out at you, the x between 91 and 99 in the comment is actually a unicode x which is encoded as a D7. If I change that to an ASCII X the program compiles and runs as expected. If I leave it as is, the program appears to run, but there is no output.
Running from the command line shows
c:\projects\Euler>scalac -feature euler4.scala
error: IO error while decoding euler4.scala with UTF-8
Please try specifying another one using the -encoding option
one error found
A little bit of research on SO suggests specifying the encoding
c:\projects\Euler>scalac -encoding UTF-8 -feature euler4.scala
error: IO error while decoding euler4.scala with UTF-8
Please try specifying another one using the -encoding option
one error found
My config is windows 10 with "Welcome to Scala 2.12.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_121)."