I\'m a newbie in Scala, and I wanted to write some sourcecodes from myself for me to get better. I\'ve written a simple object (with a main entry) in order to simulate a \"g
From the JavaDoc:
MalformedInputException thrown when an input byte sequence is not legal for given charset, or an input character sequence is not a legal sixteen-bit Unicode sequence.
Pass the currect encoding as parameter to Source.fromFile
method.
You can handle this character encoding exception by adding below snippet in your code
import scala.io.Codec
import java.nio.charset.CodingErrorAction
implicit val codec = Codec("UTF-8")
codec.onMalformedInput(CodingErrorAction.REPLACE)
codec.onUnmappableCharacter(CodingErrorAction.REPLACE)