I found the answer here:
http://mail.python.org/pipermail/python-bugs-list/2004-December/026519.html
U+201A (SINGLE LOW-9 QUOTATION MARK) should be fine, except
that \x1A is converted to EOF on Windows; then expat chokes
on all the unclosed tags.
The Solution:
Open the file 'rb'.
""" I wrote this script to illustrate the problem:
'\x1a' hex string gets truncated when read from file
Does anyone know a workaround?
"""
import struct
x = struct.pack('chhh','a', 6668,22,33)
# x is now 'a\x00\x0c\x1a\x16\x00!\x00'
# just to prove that it is working:
print...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.