Skip to content

Instantly share code, notes, and snippets.

@mallamanis
Created September 19, 2011 18:22
Show Gist options
  • Save mallamanis/1227178 to your computer and use it in GitHub Desktop.
Save mallamanis/1227178 to your computer and use it in GitHub Desktop.
convert unicode to international domain names from file
import encodings.idna
filename = '/path/to/names';
filePointer = open(filename,'r');
content = filePointer.read();
content = content.split("\n");
for line in content:
line = line.decode('utf-8');
print line.encode('idna');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment