Project

simpleidn

0.67
Low commit activity in last 3 years
A long-lived project that still receives updates
This gem allows easy conversion from punycode ACE strings to unicode UTF-8 strings and vice-versa.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 13.0.3
~> 3.10
 Project Readme

SimpleIDN¶ ↑

This gem allows easy conversion from punycode ACE strings to unicode UTF-8 strings and visa versa.

The implementation is heavily based on the RFC3492 C example implementation but simplified since it does not preserve case.

This gem works with Ruby 2.2+.

Installation¶ ↑

[sudo] gem install simpleidn

sudo is optional depending on your setup.

In your Ruby script you can now.

require 'rubygems'
require 'simpleidn'

SimpleIDN.to_unicode("xn--mllerriis-l8a.com")
=> "møllerriis.com"

SimpleIDN.to_ascii("møllerriis.com")
=> "xn--mllerriis-l8a.com"

Testing / RSpec¶ ↑

In order to run the test suite you must have rspec installed.

The test suite has been copied from the IDN gem and uses examples from JOSEFSSON test vectors, taken from DRAFT-JOSEFSSON-IDN-TEST-VECTORS-00: www.gnu.org/software/libidn/draft-josefsson-idn-test-vectors.html

Known issues¶ ↑

Does not preserve uppercase. So if, for some reason, you use uppercase characters (eg. Ø instead of ø), please take note of that.

Please report any issues!