0

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 completely discard it.

Pan
  • 6,455
  • 5
  • 27
  • 27

1 Answers1

1

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.

Jarek Potiuk
  • 19,317
  • 2
  • 60
  • 61