File: README.rdoc

package info (click to toggle)
ruby-simpleidn 0.2.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,100 kB
  • sloc: ruby: 6,725; makefile: 5
file content (39 lines) | stat: -rw-r--r-- 1,189 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
== SimpleIDN

{rdoc-image:https://app.travis-ci.com/mmriis/simpleidn.svg?branch=master}[https://app.travis-ci.com/mmriis/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 <tt>rspec</tt> 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:
http://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!