java - BeanIO - UnidentifiedRecordException when parsing UTF8 file -
i have problem when parsing file encoded utf8.
i have 2 files identical, except encoding. (i copied file , saved utf8, contents identical). 1 encoded using ansi, other utf8. file encoded ansi succesfully parsed while other file causes beanio throw unidentifiedrecordexception when calling beanreader.read() method:
org.beanio.unidentifiedrecordexception: unidentified record @ line 1
i have tried solve explicitly setting encoding utf8 using code:
public static beanreader getbeanreader(file file, streambuilder builder) { streamfactory factory = streamfactory.newinstance(); factory.define(builder); inputstream istream; try { istream = new fileinputstream(file); } catch (filenotfoundexception e) { throw new customexception("could not create beanreader, file not found", e); } reader reader = new inputstreamreader(istream, standardcharsets.utf_8); return factory.createreader("reader", reader); }
which doesn't solve issue.
what reason error?
as first line claimed erroneous, did save utf-8 without bom (that infamous zero-width space @ file start)?
Comments
Post a Comment