]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Escape special characters on output.
authorFred Drake <fdrake@acm.org>
Thu, 14 Jan 1999 17:06:09 +0000 (17:06 +0000)
committerFred Drake <fdrake@acm.org>
Thu, 14 Jan 1999 17:06:09 +0000 (17:06 +0000)
Doc/tools/sgmlconv/esis2sgml.py

index 172e71202c4a41bdebfdf0b78abd2f4abe83780f..d6f3eb920d99b5b1321ac8d8924ede4f4260a918 100755 (executable)
@@ -12,13 +12,15 @@ import esistools
 import re
 import string
 
+from xml.utils import escape
+
 
 def format_attrs(attrs):
     attrs = attrs.items()
     attrs.sort()
     s = ''
     for name, value in attrs:
-        s = '%s %s="%s"' % (s, name, value)
+        s = '%s %s="%s"' % (s, name, escape(value))
     return s
 
 
@@ -39,7 +41,7 @@ def do_convert(ifp, ofp, xml=0):
             data = data[:-1]
         if type == "-":
             data = esistools.decode(data)
-            ofp.write(data)
+            ofp.write(escape(data))
             if "\n" in data:
                 lastopened = None
             knownempty = 0