File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 7
7
def numeric_references (input ):
8
8
output = b""
9
9
for cp in input :
10
- output += b"&#x" + format (ord (cp ), b"X " ) + b";"
10
+ output += b"&#x" + format (ord (cp ), u"X" ). encode ( u"utf-8 " ) + b";"
11
11
return output
12
12
13
13
def main (request , response ):
14
14
# Undo the "magic" space with + replacement as otherwise base64 decoding will fail.
15
- value = request .GET .first (b"value" ).replace (" " , "+" )
15
+ value = request .GET .first (b"value" ).replace (b " " , b "+" )
16
16
encoding = request .GET .first (b"encoding" )
17
17
18
- output_value = numeric_references (base64 .b64decode (value ).decode (b "utf-8" ))
18
+ output_value = numeric_references (base64 .b64decode (value ).decode (u "utf-8" ))
19
19
return (
20
20
[(b"Content-Type" , b"text/html;charset=" + encoding )],
21
21
b"""<!doctype html>
You can’t perform that action at this time.
0 commit comments