[Libreoffice-commits] mso-dumper.git: msodumper/globals.py

Michael Stahl mstahl at redhat.com
Wed Feb 22 13:29:16 UTC 2017


 msodumper/globals.py |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit ec3e2adb38701a52747beeb83d63ddf04eb22d79
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Feb 22 14:24:42 2017 +0100

    globals.py: encodeName should escape XML syntax &, <, >

diff --git a/msodumper/globals.py b/msodumper/globals.py
index aaac534..27623f5 100644
--- a/msodumper/globals.py
+++ b/msodumper/globals.py
@@ -157,7 +157,13 @@ def encodeName (name, lowOnly = False, lowLimit = 0x20):
 
     newname = ''
     for i in xrange(0, n):
-        if ord(name[i]) < lowLimit or ((not lowOnly) and ord(name[i]) >= 127):
+        if name[i] == '&':
+            newname += "&"
+        elif name[i] == '<':
+            newname += "<"
+        elif name[i] == '>':
+            newname += ">"
+        elif ord(name[i]) < lowLimit or ((not lowOnly) and ord(name[i]) >= 127):
             newname += "\\x%2.2X"%ord(name[i])
         else:
             newname += name[i]


More information about the Libreoffice-commits mailing list