java - how to avoid Files.lines() throwing MalformedInputException on japanese text? -
my code throws exception
exception in thread "main" java.io.uncheckedioexception: java.nio.charset.malformedinputexception: input length = 1 @ java.io.bufferedreader$1.hasnext(bufferedreader.java:574) @ java.util.iterator.foreachremaining(iterator.java:115) @ java.util.spliterators$iteratorspliterator.foreachremaining(spliterators.java:1801) @ java.util.stream.referencepipeline$head.foreachordered(referencepipeline.java:590) when executing line
files.lines(in.topath()).foreachordered(new consumer<string>() { @override public void accept(string s) { //stuff }); the file causes behaviour when opened in notepad++ shows 
of course text garbled because of encoding, if select "convert utf-8" "encoding" menu shows correctly
which makes me assume utf-8 correct encoding, according java documentation files.lines() uses utf-8 encoding default (it's equivalent of files.lines(path, standardcharsets.utf_8)) yet still breaks when reading files japanese text, how should handle this?

Comments
Post a Comment