Bug #6119
Error validating emails with accentuated characters
Début:
07 décembre 2014
Echéance:
% réalisé:
100%
Temps estimé:
Patch proposed:
Non
Planning:
Description
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe0' in position 6....
File "authentic2/validators.py", line 44, in __call__ mxs = self.check_mxs(hostname) File "authentic2/validators.py", line 30, in check_mxs socket.gethostbyname(force_text(domain))
Note that this code part happens when dns.resolver fails to find an MX (I tested briefly and dns.resolver works with unicode domains).
Révisions associées
Historique
Mis à jour par Benjamin Dauvergne il y a plus de 9 ans
Is there something better than just checking that the email contains only ascii characters ? Should I convert the domain to the IDNA encoding ? In this case the faulting line could be replaced by:
socket.gethostbyname(force_text(domain).encode('idna'))
Mis à jour par Frédéric Péters il y a plus de 9 ans
From what I read .encode('idna') is correct (I should have mentioned it as I researched it for wcs).
Mis à jour par Benjamin Dauvergne il y a plus de 9 ans
- Statut changé de Nouveau à Résolu (à déployer)
- % réalisé changé de 0 à 100
Appliqué par commit 72f6433463206ded4e20f5e49783a2b23a849480.
Mis à jour par Benjamin Dauvergne il y a environ 9 ans
- Statut changé de Résolu (à déployer) à Fermé
Validate email domain containing non ASCII characters
fixes #6119