mirror of
https://github.com/chocolate-doom/master-server.git
synced 2024-11-21 20:11:22 +00:00
Correctly handle UTF-8 server names.
This fixes a problem where the page does not display properly if a server name contains a non-ASCII character (see discussion on chocolate-doom/chocolate-doom#229).
This commit is contained in:
parent
2cc103e783
commit
65704ad398
1 changed files with 3 additions and 3 deletions
|
@ -164,7 +164,7 @@ def read_template(filename):
|
|||
""" Read HTML template file. """
|
||||
|
||||
file = open(filename)
|
||||
result = file.read()
|
||||
result = file.read().decode('utf8')
|
||||
file.close()
|
||||
|
||||
return result
|
||||
|
@ -172,9 +172,9 @@ def read_template(filename):
|
|||
def output_html(html):
|
||||
""" Output HTML data back to client. """
|
||||
|
||||
print "Content-Type: text/html"
|
||||
print "Content-Type: text/html; charset=utf-8"
|
||||
print
|
||||
print html
|
||||
sys.stdout.write(html.encode('utf8'))
|
||||
|
||||
template = read_template("index.template")
|
||||
|
||||
|
|
Loading…
Reference in a new issue