python - xml parsing issue encoding error -


i have xml file this

<?xml version="1.0" encoding="utf-8"?> <tw>     <tweet>         <yazi>atılacak tweet 1</yazi>         <resim>resim.png</resim>     </tweet>     <tweet>         <yazi>atılacak tweet 2</yazi>         <resim>yok</resim>     </tweet> </tw> 

i'm trying read with

import xml.etree.elementtree ett  e = ett.parse("tweet.xml").getroot() 

but error,

xml.etree.elementtree.parseerror: encoding specified in xml declaration incorrect: line 1, column 31

why? how can fix this, searched lot , xml file looks ok. don't understand why can't read file.

you have invalid utf-8 char in file, e.g. xml file iso-8859-1 encoded... or can try utf-8 instead of utf-8


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -