Created
December 10, 2015 19:11
-
-
Save Kwpolska/28c7a67c6839c8fbd71f to your computer and use it in GitHub Desktop.
IDNA vs Punycode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Python 3.5.1 (default, Dec 7 2015, 12:58:09) | |
Type "copyright", "credits" or "license" for more information. | |
IPython 4.0.0 -- An enhanced Interactive Python. | |
? -> Introduction and overview of IPython's features. | |
%quickref -> Quick reference. | |
help -> Python's own help system. | |
object? -> Details about 'object', use 'object??' for extra details. | |
In [1]: 'ąbc.pl'.encode('punycode') | |
Out[1]: b'bc.pl-2wa' | |
In [2]: 'abc.pl'.encode('punycode') | |
Out[2]: b'abc.pl-' | |
In [3]: 'ąbc.pl'.encode('punycode') | |
Out[3]: b'bc.pl-2wa' | |
In [4]: 'ąbc.pl'.encode('idna') | |
Out[4]: b'xn--bc-ola.pl' | |
In [5]: 'abc.pl'.encode('punycode') | |
Out[5]: b'abc.pl-' | |
In [6]: 'abc.pl'.encode('idna') | |
Out[6]: b'abc.pl' | |
In [7]: 'ąbc'.encode('punycode') | |
Out[7]: b'bc-ola' | |
In [8]: 'ąbc'.encode('idna') | |
Out[8]: b'xn--bc-ola' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment