Byte order mark removal in xml files using Java IO
The byte order mark is the first 3 bytes in my xml file. How do I remove the Byte order mark from the xml file programmatically? I want to comp开发者_如何学Pythonletely discard it.
Rather than removing it, I use a special reader which reacts properly to BOM (and uses proper encoding, based on read BOM): I copied it from elsewhere (see note inside) but it is open-sourced in my android-menu-navigator project:
http://code.google.com/p/android-menu-navigator/source/browse/src/pl/polidea/navigator/UnicodeReader.java
You can use this reader anyway to read content of XML and write it elsewhere, effectively removing the BOM.
精彩评论