今天跑测试的时候遇到了java.nio.charset.MalformedInputException: Input length = 1
异常。
错误爆在一行读包括中文字符文件的代码上,猜想应该是编码问题。然后搜到了这个,其中@ignasi35有条回复说道”Turns out the updated plugin in IntelliJ was resolving LC_CTYPE=”C” causing the JVM to pick the file.encoding == US-ASCII. Setting LC_CTYPE=”UTF-8” on my .bash_profil solved the issue in all my run environments.”
所以直接在.bash_profil中添加:
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
然后source ~/.bashrc
,再跑,问题解决。
Original link:https://izhangzhihao.github.io//2017/12/28/Sbt-MalformedInputException/