This is a Ruby tree! It shows every object from the Ruby Programming Language in a tree format.

convert

        # Encoding::Converter.convert

(from ruby core)
### Implementation from Converter
---
    ec.convert(source_string) -> destination_string

---

Convert source_string and return destination_string.

source_string is assumed as a part of source. i.e.  :partial_input=>true
is specified internally. finish method should be used last.

    ec = Encoding::Converter.new("utf-8", "euc-jp")
    puts ec.convert("\u3042").dump     #=> "\xA4\xA2"
    puts ec.finish.dump                #=> ""

    ec = Encoding::Converter.new("euc-jp", "utf-8")
    puts ec.convert("\xA4").dump       #=> ""
    puts ec.convert("\xA2").dump       #=> "\xE3\x81\x82"
    puts ec.finish.dump                #=> ""

    ec = Encoding::Converter.new("utf-8", "iso-2022-jp")
    puts ec.convert("\xE3").dump       #=> "".force_encoding("ISO-2022-JP")
    puts ec.convert("\x81").dump       #=> "".force_encoding("ISO-2022-JP")
    puts ec.convert("\x82").dump       #=> "\e$B$\"".force_encoding("ISO-2022-JP")
    puts ec.finish.dump                #=> "\e(B".force_encoding("ISO-2022-JP")

If a conversion error occur, Encoding::UndefinedConversionError or
Encoding::InvalidByteSequenceError is raised.
Encoding::Converter#convert doesn't supply methods to recover or restart
from these exceptions. When you want to handle these conversion errors,
use Encoding::Converter#primitive_convert.



      

This is MURDOC! A Ruby documentation browser inspired by Smalltalk-80. It allows you to learn about Ruby by browsing through its class hierarchies, and see any of its methods.