Skip to content

Instantly share code, notes, and snippets.

@mccun934
Created September 5, 2012 19:56
Show Gist options
  • Select an option

  • Save mccun934/3643559 to your computer and use it in GitHub Desktop.

Select an option

Save mccun934/3643559 to your computer and use it in GitHub Desktop.
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'simpleidn'
=> true
irb(main):005:0> SimpleIDN.to_ascii("møllerriis")
=> "xn--mllerriis-l8a"
irb(main):006:0> greek = 'Τὴ γλῶσσα μοῦ ἔδωσαν ἑλληνικὴ'
=> "Τὴ γλῶσσα μοῦ ἔδωσαν ἑλληνικὴ"
irb(main):008:0> SimpleIDN.to_ascii(greek)
=> "xn-- -4jd3fcmm6awmegakue3a0fag1lt104e7bau9lya092acn"
irb(main):009:0> SimpleIDN.to_ascii('asdf')
=> "asdf"
irb(main):010:0> SimpleIDN.to_ascii('யாமறிந்த மொழிகளிலே தமிழ்மொழி')
=> "xn-- -h7g2ddt5bddabzsnngb8nvafced8pscn7dq"
irb(main):011:0>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment