If you accept data from various sources, and want to produce XML that can be consumed, one thing you need to be careful about is character set issues. On the input side, people often lie or make mistakes. Many don’t specify an encoding, and while XML’s default is utf-8, it is common to find iso-8859-1 or even win-1252 data. On the output side, if you want to produce something that can be consumed