diff options
Diffstat (limited to 'django/utils/encoding.py')
-rw-r--r-- | django/utils/encoding.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/django/utils/encoding.py b/django/utils/encoding.py index 94b63762db..2e2ad44e31 100644 --- a/django/utils/encoding.py +++ b/django/utils/encoding.py @@ -218,6 +218,11 @@ def escape_uri_path(path): return quote(path, safe="/:@&+$,-_.!~*'()") +def punycode(domain): + """Return the Punycode of the given domain if it's non-ASCII.""" + return domain.encode('idna').decode('ascii') + + def repercent_broken_unicode(path): """ As per section 3.2 of RFC 3987, step three of converting a URI into an IRI, |