I´m trying to parse one xml but it shows a error, if I put a system.out.println
to the String
i see it.
before
<?xml version="1.0"
after
?<?xml version="1.0"
I´m changing the charset to UTF-8
but didn´t works, so, what should I do?
You have a UTF-8 string (which is why Notepad++ is recognizing it as such), but UTF-8 doesn't require a BOM. Some programs produce it; some don't. This leads to occasional confusion when reading files - some readers (like the one you're using in your Java code) don't recognize and ignore it. I'd recommend something like the accepted answer to this question or this one for removing it. Make sure you implement a check to determine if the first 3 bytes actually are a BOM before removing them from all incoming strings.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With