simpleidn.cr
simpleidn.cr
This is a Crystal port of the Ruby library simpleidn.
It provides easy conversion from punycode ACE strings to unicode strings and vice versa.
Installation
-
Add the dependency to your
shard.yml:dependencies: simpleidn: github: cyangle/simpleidn.cr -
Run
shards install
Note: This shard requires libicu to be installed on your system.
- Ubuntu/Debian:
sudo apt-get install libicu-dev - macOS:
brew install icu4c
Usage
require "simpleidn"
# Convert to ASCII (Punycode)
SimpleIDN.to_ascii("møllerriis.com")
# => "xn--mllerriis-l8a.com"
# Convert to Unicode
SimpleIDN.to_unicode("xn--mllerriis-l8a.com")
# => "møllerriis.com"
# Handle mapped characters (UTS #46)
SimpleIDN.to_ascii("Faß.de")
# => "xn--fa-hia.de" (ss maps to ss)
SimpleIDN.to_unicode("xn--fa-hia.de")
# => "fass.de"
Development
To run tests:
crystal spec
To format the code:
crystal tool format
This project uses the icu shard for normalization and handling of special characters.
Contributing
- Fork it (https://github.com/cyangle/simpleidn.cr/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- Chao Yang - creator and maintainer
Repository
simpleidn.cr
Owner
Statistic
- 0
- 0
- 0
- 1
- 1
- 1 day ago
- January 14, 2026
License
MIT License
Links
Synced at
Wed, 14 Jan 2026 04:12:45 GMT
Languages