##// END OF EJS Templates
run-tests: do cdata escaping using bytes instead of str
Augie Fackler -
r25051:9c28f323 default
parent child Browse files
Show More
@@ -354,7 +354,7 b' def vlog(*msg):'
354
354
355 # Bytes that break XML even in a CDATA block: control characters 0-31
355 # Bytes that break XML even in a CDATA block: control characters 0-31
356 # sans \t, \n and \r
356 # sans \t, \n and \r
357 CDATA_EVIL = re.compile(r"[\000-\010\013\014\016-\037]")
357 CDATA_EVIL = re.compile(br"[\000-\010\013\014\016-\037]")
358
358
359 def cdatasafe(data):
359 def cdatasafe(data):
360 """Make a string safe to include in a CDATA block.
360 """Make a string safe to include in a CDATA block.
@@ -364,7 +364,7 b' def cdatasafe(data):'
364 replaces illegal bytes with ? and adds a space between the ]] so
364 replaces illegal bytes with ? and adds a space between the ]] so
365 that it won't break the CDATA block.
365 that it won't break the CDATA block.
366 """
366 """
367 return CDATA_EVIL.sub('?', data).replace(']]>', '] ]>')
367 return CDATA_EVIL.sub(b'?', data).replace(b']]>', b'] ]>')
368
368
369 def log(*msg):
369 def log(*msg):
370 """Log something to stdout.
370 """Log something to stdout.
General Comments 0
You need to be logged in to leave comments. Login now