Browse Source

Fix charset usage

master
JustAnotherArchivist 2 years ago
parent
commit
eb30c894c3
1 changed files with 9 additions and 5 deletions
  1. +9
    -5
      irclog.py

+ 9
- 5
irclog.py View File

@@ -943,7 +943,7 @@ class WebServer:
if hidden:
continue
lines.append(f'{"(PW) " if auth else ""}<a href="/{html.escape(path)}">{html.escape(channel)}</a> (<a href="/{html.escape(path)}/today">today&#x27;s log</a>, <a href="/{html.escape(path)}/search">search</a>)')
return aiohttp.web.Response(text = f'<!DOCTYPE html><html lang="en"><head><title>IRC logs</title></head><body>{"<br />".join(lines)}</body></html>', content_type = 'text/html; charset=UTF-8')
return aiohttp.web.Response(text = f'<!DOCTYPE html><html lang="en"><head><title>IRC logs</title></head><body>{"<br />".join(lines)}</body></html>', content_type = 'text/html', charset = 'UTF-8')

async def get_status(self, request):
self.logger.info(f'Received request {id(request)} from {request.remote!r} for {request.path!r}')
@@ -970,7 +970,8 @@ class WebServer:
'</body>',
'</html>'
]),
content_type = 'text/html; charset=UTF-8'
content_type = 'text/html',
charset = 'UTF-8',
)

def _file_iter_with_path(self, fn, path):
@@ -1065,7 +1066,8 @@ class WebServer:
'</body>',
'</html>',
]).encode('utf-8', errors = 'surrogateescape'),
content_type = 'text/html; charset=UTF-8'
content_type = 'text/html',
charset = 'UTF-8',
)

async def log_redirect_today(self, request):
@@ -1105,7 +1107,8 @@ class WebServer:
'</body>',
'</html>'
]),
content_type = 'text/html; charset=UTF-8'
content_type = 'text/html',
charset = 'UTF-8',
)

# Run the search with grep, limiting memory use, output size, and runtime and setting the niceness.
@@ -1207,7 +1210,8 @@ class WebServer:
'</body>',
'</html>'
]).encode('utf-8', errors = 'surrogateescape'),
content_type = 'text/html; charset=UTF-8'
content_type = 'text/html',
charset = 'UTF-8',
)




Loading…
Cancel
Save