summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Albert <albertj@us.ibm.com>2015-03-20 23:54:34 -0500
committerJason Albert <albertj@us.ibm.com>2015-03-20 23:54:34 -0500
commita463b1a88f068521a397e7a71dbf051701a7c72c (patch)
tree0b0e2150e81370466275cc097a9744f6e5b6008b
parent9bfa2a1744e79b961c9076b62ebf158b193f3835 (diff)
downloadvpdtools-a463b1a88f068521a397e7a71dbf051701a7c72c.tar.gz
vpdtools-a463b1a88f068521a397e7a71dbf051701a7c72c.zip
Update to remove null terminators since it screwed up the xml
-rwxr-xr-xreverseVpd.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/reverseVpd.py b/reverseVpd.py
index 2f1f9b4..55119a1 100755
--- a/reverseVpd.py
+++ b/reverseVpd.py
@@ -21,7 +21,8 @@ import operator
def asciiAllowed(s):
for c in s:
- if c not in string.ascii_letters and c not in string.digits and c not in string.whitespace:
+ if c not in string.printable and c != '\0':
+ #if c not in string.ascii_letters and c not in string.digits and c not in string.whitespace:
return False
return True
@@ -239,7 +240,8 @@ for recordItem in (sorted(recordNames.values(), key=operator.attrgetter('recordO
if (asciiState):
ET.SubElement(keyword, "kwformat").text = "ascii"
- ET.SubElement(keyword, "kwdata").text = keywordData.decode()
+ # Convert to ascii and strip off any padded null terminators
+ ET.SubElement(keyword, "kwdata").text = keywordData.decode().rstrip('\0')
else:
ET.SubElement(keyword, "kwformat").text = "hex"
ET.SubElement(keyword, "kwdata").text = binascii.hexlify(keywordData).decode()
OpenPOWER on IntegriCloud