How to load XML when PHP can't indicate the right encoding?

前端 未结 4 1617
梦谈多话
梦谈多话 2020-12-12 00:08

I\'m trying to load an XML source from a remote location, so i have no control of the formatting. Unfortunately the XML file I\'m trying to load has no encoding:

<         


        
4条回答
  •  一个人的身影
    2020-12-12 00:57

    You could edit the document ('pre-process it') to specify the encoding it is being delivered in adding an XML declaration. What that is, you'll have to ascertain yourself, of course. The DOM object should then parse it.

    Example XML declaration:

    
    

提交回复
热议问题