PHP XML encoding

I meet a same encoding problem using DOMDocument::load XML described at

In short, if the XML has encoding=”UTF-8″, it will be parsed properly. In my case, the XML has encoding=”windows-1252″, but it has been changed to “UTF-8”. For example, “Schütze” is changed to “Schütze”. My guess is that DOMDocument::load only recognizes  “UTF-8”, otherwise it changes other encoding to “UTF-8”.

My solution is “iconv(“UTF-8″,”windows-1252″,$str)” which changes it back to original encoding. This solution assumes you know the original encoding.