Skip to content

A simple Python tool to encode Unicode domain names into Punycode (IDNA) format and decode Punycode back to Unicode.

Notifications You must be signed in to change notification settings

0xberka/punycoder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Punycoder

Punycoder is a Python tool to encode Unicode domain names into Punycode (IDNA) format and decode Punycode back into Unicode. It is useful for anyone working with Internationalized Domain Names (IDNs).

See: RFC 3490 - Internationalizing Domain Names in Applications (IDNA)

Features

  • Encode Unicode domain names to Punycode.
  • Decode Punycode domain names back to Unicode.
  • Command-line interface (CLI)
  • Lightweight, dependency-free, Pythonic
  • Compatible with Python 3.5+

Usage

Encode a Unicode domain to Punycode:

./punycoder -e café.com
# Output: xn--caf-dma.com

Decode a Punycode domain to Unicode:

./punycoder -d xn--caf-dma.com
# Output: café.com

Invalid inputs are printed to stderr:

./punycoder -d xn--invalid--domain
# Error: decoding with 'idna' codec failed (UnicodeError: Violation of BIDI requirement 2)

About

A simple Python tool to encode Unicode domain names into Punycode (IDNA) format and decode Punycode back to Unicode.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages