#27125: Can not support django Internationalized domain name in URLValidation
-------------------------------+--------------------
Reporter: RaminFP | Owner: nobody
Type: New feature | Status: new
Component: Uncategorized | Version: 1.10
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
Hi,
i see here
[https://github.com/django/django/blob/master/django/core/validators.py#L79&L156
validator.py], there isn't docs aboud
[https://en.wikipedia.org/wiki/Internationalized_domain_name IDN]
supported django IDN or no,
there is arabic domains on internet like [http://عربي.امارات عربي.امارات]
{{{
from django.core.validators import URLValidator
validate = URLValidator()
validate('http://عربی.امارات')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\django\core\validators.py", line
114, in __call__
value = force_text(value)
File "C:\Python27\lib\site-packages\django\utils\encoding.py", line 88,
in force_text
raise DjangoUnicodeDecodeError(s, *e.args)
django.utils.encoding.DjangoUnicodeDecodeError: 'utf8' codec can't decode
byte 0x9f in position 12: invalid start byte. You passed in
'http://\xe3\xa9\xa0?.\x9f\xea\x9f\xa9\x9f\xa2' (<type 'str'>)
}}}
You can use idn2 tool.
{{{
root@ramin ~ > idn2 'عربي.امارات'
xn--ngbrx4e.xn--mgbaam7a8h
root@ramin > nslookup $(idn2 'عربي.امارات')
Server: 127.0.1.1
Address: 127.0.1.1#53
Non-authoritative answer:
Name: xn--ngbrx4e.xn--mgbaam7a8h
Address: 79.98.120.105
root@ramin > nmap $(idn2 'عربي.امارات') -p80
Starting Nmap 6.40 ( http://nmap.org ) at 2016-08-26 12:09 +07
Nmap scan report for xn--ngbrx4e.xn--mgbaam7a8h (79.98.120.105)
Host is up (0.23s latency).
rDNS record for 79.98.120.105: web-lb0.web.308th.dubai.aeda.net.ae
PORT STATE SERVICE
80/tcp open http
Nmap done: 1 IP address (1 host up) scanned in 0.88 seconds
}}}
or use CURL
{{{
$ curl --head xn--ngbrx4e.xn--mgbaam7a8h
% Total % Received % Xferd Average Speed Time Time Time
Current
Dload Upload Total Spent Left
Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:--
0HTTP/1.0 200 OK
Date: Fri, 26 Aug 2016 05:09:07 GMT
Server: Apache
X-Powered-By: PHP/5.3.3
Content-Type: text/html
Connection: close
}}}
please see this answer [http://stackoverflow.com/questions/1755144/how-to-
validate-domain-name-in-php/4694816#4694816 stackoverflow]
Thanks,
Ramin
--
Ticket URL: <https://code.djangoproject.com/ticket/27125>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/050.c79fda205460199a80ebef1c8138e58f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.