BOM vs explicit encoding declaration in XML



Just wondering why XML uses an explicit encoding declaration. For me it looks like a strange design. Consider an UTF-16 encoding declaration(see example). Doesn't a BOM at the beginning of the stream/file make this obsolete? What happens if a BOM indicates UTF-16 and the explicit encoding declaration is set as UTF-8? Does that even make any sense?



<?xml version="1.0" encoding="utf-16" ?>

No comments:

Post a Comment