# module Kramdown::Utils::Unidecoder

Provides the ability to tranliterate Unicode strings into plain ASCII ones.

### Constants

CODEPOINTS

### Public Class Methods

decode(string) click to toggle source

Transliterate string from Unicode into ASCII.

       # File lib/kramdown/utils/unidecoder.rb
    28 def self.decode(string)
    29   string.gsub(/[^\x00-\x7f]/u) do |codepoint|
    30     unpacked = codepoint.unpack1("U")
    31     CODEPOINTS[sprintf("x%02x", unpacked >> 8)][unpacked & 255]
    32   rescue StandardError
    33     "?"
    34   end
    35 end