better cleaning
This commit is contained in:
parent
13fbb70ef2
commit
8aa2e5761a
|
@ -11,9 +11,9 @@ urllib.parse.uses_relative.append("gemini")
|
|||
urllib.parse.uses_netloc.append("gemini")
|
||||
|
||||
def clean(text):
|
||||
return text.replace('&', '&').replace('<','<').replace('>','>')
|
||||
return text.replace('&', '&').replace('<','<').replace('>','>').replace('"', '"').replace('\'', ''')
|
||||
|
||||
print("Content-type: text/html\n\n")
|
||||
print("Content-type: text/html\r\n\r\n")
|
||||
|
||||
if getenv('QUERY_STRING'):
|
||||
try:
|
||||
|
@ -29,7 +29,7 @@ if getenv('QUERY_STRING'):
|
|||
preform = False
|
||||
listmode = False
|
||||
blockquote = False
|
||||
for line in parser.parseText(responsetext.decode()):
|
||||
for line in parser.parseText(responsetext.decode('utf8', errors='ignore')):
|
||||
if line.linetype == gemtextparser.LineType.PREFORM:
|
||||
if not preform:
|
||||
print("<pre><code>")
|
||||
|
@ -90,7 +90,7 @@ if getenv('QUERY_STRING'):
|
|||
|
||||
else:
|
||||
print("<pre><code>")
|
||||
print(clean(responsetext.decode()))
|
||||
print(clean(responsetext.decode('utf8', errors='ignore')))
|
||||
print("</code></pre>")
|
||||
|
||||
elif response.responsecode == 20:
|
||||
|
|
Loading…
Reference in New Issue