Probably the incompatible character encoding used in the interpreter. For example, here is my conclusion:
scala> System.getProperty("file.encoding") res0: String = UTF-8 scala> java.util.regex.Pattern.compile("\\p{L}").matcher("ä").matches() res1: Boolean = true
Thus, the solution should run scala with -Dfile.encoding=UTF-8 . Note, however, this blog post (which is a bit old):
The only reliable way we found to set the default character encoding for Scala is to set $ JAVA_OPTS before starting. Application:
$ JAVA_OPTS="-Dfile.encoding=utf8" scala [...] Just trying to set scala -Dfile.encoding=utf8 does not seem to do this. [...]
Not here, but it can happen this way: alternatively, your “ä” can be a diaeresis (umlaut) sign on “a”, for example:
scala> println("a\u0308") ä scala> java.util.regex.Pattern.compile("\\p{L}").matcher("a\u0308").matches() res1: Boolean = false
This is sometimes a problem on some systems that create diacritics through Unicode combining characters (I think OS X is one, at least on some versions). For more information, see the Question of Paul .
source share