#76 DNS lookup error when e-mail address is unicode

open
nobody
None
5
2009-05-07
2009-05-07
Joseph Tate
No

I'm using Python 2.4, but it happens with python 2.5 also. pydns is 2.3.3, formencode is version 1.2.2.

Reproducing test case:
>>> import formencode.validators
>>> e = formencode.validators.Email(resolve_domain=True)
>>> e.to_python(u'foo@example.com')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ecardg5/python/lib/python2.5/site-packages/FormEncode-1.2.1-py2.5.egg/formencode/api.py", line 416, in to_python
vp(value, state)
File "/home/ecardg5/python/lib/python2.5/site-packages/FormEncode-1.2.1-py2.5.egg/formencode/validators.py", line 1364, in validate_python
a=DNS.DnsRequest(domain, qtype='mx').req().answers
File "build/bdist.linux-i686/egg/DNS/Base.py", line 202, in req
File "build/bdist.linux-i686/egg/DNS/Lib.py", line 461, in addQuestion
File "build/bdist.linux-i686/egg/DNS/Lib.py", line 128, in addname
UnicodeDecodeError: 'ascii' codec can't decode byte 0x92 in position 1: ordinal not in range(128)

I note that 2126902 was already filed, but closed as wfm.

Discussion