In 25 xml version encoding utf-8 root body жажа body root In 26 s_cp12

1
2
3
4
5
6
7
8
9
In [25]: s = '<?xml version="1.0" encoding="utf-8"?><root><body>жажа</body></root>'
In [26]: s_cp1251 = s.decode('utf-8').encode('cp1251').replace('utf-8','cp1251')
In [27]: doc = etree.fromstring(s_cp1251)
In [28]: print doc.find('body').text
-------> print(doc.find('body').text)
жажа