Coder Social home page Coder Social logo

simpleidn's Introduction

SimpleIDN

<img src=“https://travis-ci.org/mmriis/simpleidn.svg?branch=master” alt=“Build Status” />

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 1.9.3, 2.0, 2.1, 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!

simpleidn's People

Contributors

pzb avatar mmriis avatar weppos avatar timoschilling avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.