From 13d9211b4dcec940b8bf514e678a068dafa656c5 Mon Sep 17 00:00:00 2001 From: Sam Ruby Date: Sat, 4 Nov 2006 13:03:54 -0500 Subject: [PATCH] Bullet-proofing --- planet/reconstitute.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/planet/reconstitute.py b/planet/reconstitute.py index a52df27..0f12889 100644 --- a/planet/reconstitute.py +++ b/planet/reconstitute.py @@ -25,7 +25,11 @@ illegal_xml_chars = re.compile("[\x01-\x08\x0B\x0C\x0E-\x1F]") def createTextElement(parent, name, value): """ utility function to create a child element with the specified text""" if not value: return - if isinstance(value,str): value=value.decode('utf-8') + if isinstance(value,str): + try: + value=value.decode('utf-8') + except: + value=value.decode('iso-8859-1') xdoc = parent.ownerDocument xelement = xdoc.createElement(name) xelement.appendChild(xdoc.createTextNode(value))