Bug when handling Unicode in TXT records

master
Stephane Bortzmeyer 10 years ago
parent 0999ea2458
commit 45de4c221d
  1. 9
      DNSLG/Formatter.py
  2. 2
      setup.py
  3. 1
      test-server-with-config-file.py

@ -604,7 +604,11 @@ class XmlFormatter(Formatter):
suppressXMLDeclaration=True,
outputEncoding=querier.encoding)
elif rdata.rdtype == dns.rdatatype.TXT:
icontext.addGlobal ("text", " ".join(rdata.strings))
# Yes, some people add Unicode in TXT records,
# see mailclub.tel for instance. We assume
# UTF-8
text = unicode(" ".join(rdata.strings), "UTF-8")
icontext.addGlobal ("text", text)
self.txt_template.expand (icontext, iresult,
suppressXMLDeclaration=True,
outputEncoding=querier.encoding)
@ -963,7 +967,8 @@ class HtmlFormatter(Formatter):
suppressXMLDeclaration=True,
outputEncoding=querier.encoding)
elif rdata.rdtype == dns.rdatatype.TXT:
icontext.addGlobal ("text", "\n".join(rdata.strings))
text = unicode(" ".join(rdata.strings), "UTF-8")
icontext.addGlobal ("text", text)
self.txt_template.expand (icontext, iresult,
suppressXMLDeclaration=True,
outputEncoding=querier.encoding)

@ -6,7 +6,7 @@ use_setuptools()
from setuptools import setup
setup(name='DNS-LG',
version='2013012001',
version='2013012002',
description='DNS Looking Glass',
license='BSD',
author='Stephane Bortzmeyer',

@ -16,6 +16,7 @@ default_values = {'email_administrator': None,
'url_css': None,
'url_base_service': DNSLG.default_base_url,
'file_favicon': None,
'forbidden_suffixes': "",
'encoding': DNSLG.default_encoding,
'size_edns': '2048',
'bucket_size': '10',

Loading…
Cancel
Save