Support for the Ruby 2.4 series has ended. See here for reference.

In Files

  • rexml/encoding.rb
  • rexml/parsers/baseparser.rb
  • rexml/source.rb

Class/Module Index [+]

Quicksearch

REXML::Encoding

Attributes

encoding[R]

ID —> Encoding name

Public Instance Methods

decode(string) click to toggle source
 
               # File rexml/encoding.rb, line 29
def decode(string)
  string.encode(::Encoding::UTF_8, @encoding)
end
            
encode(string) click to toggle source
 
               # File rexml/encoding.rb, line 25
def encode(string)
  string.encode(@encoding)
end
            
encoding=(encoding) click to toggle source
 
               # File rexml/encoding.rb, line 7
def encoding=(encoding)
  encoding = encoding.name if encoding.is_a?(Encoding)
  if encoding.is_a?(String)
    original_encoding = encoding
    encoding = find_encoding(encoding)
    unless encoding
      raise ArgumentError, "Bad encoding name #{original_encoding}"
    end
  end
  return false if defined?(@encoding) and encoding == @encoding
  if encoding
    @encoding = encoding.upcase
  else
    @encoding = 'UTF-8'
  end
  true
end