Created
September 30, 2014 07:29
-
-
Save mrluanma/c21821eabb5c29a889fc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 | |
from lxml import etree as ET | |
from io import BytesIO | |
gb2312_xml = u"""<?xml version="1.0" encoding="gb2312" ?> | |
<node>中文</node>""".encode("gb2312") | |
print(ET.tostring(ET.parse(BytesIO(gb2312_xml)), encoding="utf-8")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment