module Ronin::Support::Encoding::Punycode
Contains methods for encoding/decoding Punycode
encoded Strings.
## Core-Ext Methods
-
{String#punycode_encode}
-
{String#punycode_decode}
@see en.wikipedia.org/wiki/Punycode
@api public
@since 1.0.0
Public Class Methods
Source
# File lib/ronin/support/encoding/punycode.rb, line 73 def self.decode(data) Addressable::IDNA.to_unicode(data) end
Decodes a Punycode
String
back into unicode.
@param [String] data
The punycode String to decode.
@return [String]
The decoded unicode String.
@example
Encoding::Punycode.decode("xn--8ws00zhy3a") # => "詹姆斯"
Source
# File lib/ronin/support/encoding/punycode.rb, line 54 def self.encode(data) Addressable::IDNA.to_ascii(data) end
Encodes a unicode String
into Punycode
.
@param [String] data
The unicode String to encode.
@return [String]
The punycode String.
@example
Encoding::Punycode.encode("詹姆斯") # => "xn--8ws00zhy3a"