Timezones for (date)-times and encoding for strings are no problem if you do not have do convert between them. In Ruby 1.9 and 2.0, encodings seem to be the new timezones from older Ruby versions, they cause nothing but trouble. Iconv has been replaced by the native encoding functions. How do you convert from the standard UTF-8 to ISO-8859-1, for example for the use in Windows systems? In the Ruby 2.0 console the encode function does not work, although it should be able to convert from a source encoding to a destination encoding via encode(dst_encoding, src_encoding) → str
?
>> "ABC äöüÄÖÜ".encoding
=> #<Encoding:UTF-8>
>> "ABC äöüÄÖÜ".encode("UTF-8").encode("ISO-8859-1")
=> "ABC \xE4\xF6\xFC\xC4\xD6\xDC"
>> "ABC äöüÄÖÜ".encode("ISO-8859-1","UTF-8")
=> "ABC \xE4\xF6\xFC\xC4\xD6\xDC"
I am using Ruby 2.0.0 (Revision 41674) on a linux system.