Take the 2-minute tour ×

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.

share|improve this question
could you paste the beginning of your xml file here? –  woliveirajr Jun 30 '11 at 20:19
þÿ<?xml version="1.0" encoding="utf-8" standalone="yes"?> –  Pan Jun 30 '11 at 20:23
add comment

1 Answer

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:


You can use this reader anyway to read content of XML and write it elsewhere, effectively removing the BOM.

share|improve this answer
add comment

Your Answer


