Module: Addressable::IDNA

### Home Classes Methods

### In Files

- lib/addressable/idna/native.rb
- lib/addressable/idna/pure.rb

### Namespace

- CLASS Addressable::IDNA::PunycodeBadInput
- CLASS Addressable::IDNA::PunycodeBigOutput
- CLASS Addressable::IDNA::PunycodeOverflow

### Methods

- ::to_ascii
- ::to_unicode
- ::unicode_normalize_kc

### Class/Module Index

Quicksearch

- Addressable
- Addressable::IDNA
- Addressable::IDNA::PunycodeBadInput
- Addressable::IDNA::PunycodeBigOutput
- Addressable::IDNA::PunycodeOverflow
- Addressable::Template
- Addressable::Template::InvalidTemplateOperatorError
- Addressable::Template::InvalidTemplateValueError
- Addressable::Template::MatchData
- Addressable::Template::TemplateOperatorAbortedError
- Addressable::VERSION

No matching classes.

# Addressable::IDNA

### Constants

ACE_MAX_LENGTH
ACE_PREFIX
COMPOSITION_TABLE
HANGUL_LBASE
HANGUL_LCOUNT
HANGUL_NCOUNT
HANGUL_SBASE
HANGUL_SCOUNT
HANGUL_TBASE
HANGUL_TCOUNT
HANGUL_VBASE
HANGUL_VCOUNT
PUNYCODE_BASE
PUNYCODE_DAMP
PUNYCODE_DELIMITER
PUNYCODE_INITIAL_BIAS
PUNYCODE_INITIAL_N
PUNYCODE_MAXINT
PUNYCODE_PRINT_ASCII
PUNYCODE_SKEW
PUNYCODE_TMAX
PUNYCODE_TMIN
UNICODE_DATA

  This is a sparse Unicode table. Codepoints without entries are assumed to have the value: [0, 0, nil, nil, nil, nil, nil]

UNICODE_DATA_CANONICAL
UNICODE_DATA_COMBINING_CLASS
UNICODE_DATA_COMPATIBILITY
UNICODE_DATA_EXCLUSION
UNICODE_DATA_LOWERCASE
UNICODE_DATA_TITLECASE
UNICODE_DATA_UPPERCASE
UNICODE_MAX_LENGTH
UNICODE_TABLE

  This module is loosely based on idn_actionmailer by Mick Staugaard, the unicode library by Yoshida Masato, and the punycode implementation by Kazuhiro Nishiyama. Most of the code was copied verbatim, but some reformatting was done, and some translation from C was done.

  Without their code to work from as a base, we'd all still be relying on the presence of libidn. Which nobody ever seems to have installed.

  Original sources: github.com/staugaard/idn_actionmailer www.yoshidam.net/Ruby.html#unicode rubyforge.org/frs/?group_id=2550

UTF8_REGEX
UTF8_REGEX_MULTIBYTE

### Public Class Methods

to_ascii(value) click to toggle source

    # File lib/addressable/idna/native.rb, line 34
    def self.to_ascii(value)
      value.to_s.split('.', -1).map do |segment|
        if segment.size > 0
          IDN::Idna.toASCII(segment)
        else
          ''
        end
      end.join('.')
    end

to_unicode(value) click to toggle source

    # File lib/addressable/idna/native.rb, line 44
    def self.to_unicode(value)
      value.to_s.split('.', -1).map do |segment|
        if segment.size > 0
          IDN::Idna.toUnicode(segment)
        else
          ''
        end
      end.join('.')
    end

unicode_normalize_kc(value) click to toggle source

    # File lib/addressable/idna/native.rb, line 30
    def self.unicode_normalize_kc(value)
      IDN::Stringprep.nfkc_normalize(value.to_s)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.