title: How to convert UTF-8 to ISO-8859-1 in Ruby 2.0?
body: <p>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. <a href="http://en.wikipedia.org/wiki/Iconv" rel="noreferrer">Iconv</a> has been replaced by the native encoding functions. How do you convert from the standard <a href="http://en.wikipedia.org/wiki/UTF-8" rel="noreferrer">UTF-8</a> to <a href="http://en.wikipedia.org/wiki/ISO/IEC_8859-1" rel="noreferrer">ISO-8859-1</a>, for example for the use in Windows systems? In the Ruby 2.0 console the <a href="http://ruby-doc.org/core-1.9.3/String.html#method-i-encode" rel="noreferrer">encode function</a> does not work, although it should be able to convert from a source encoding to a destination encoding via <code>encode(dst_encoding, src_encoding) → str</code>?</p>
  
  <pre><code>&gt;&gt; "ABC äöüÄÖÜ".encoding
  =&gt; #&lt;Encoding:UTF-8&gt;
  &gt;&gt; "ABC äöüÄÖÜ".encode("UTF-8").encode("ISO-8859-1")
  =&gt; "ABC \xE4\xF6\xFC\xC4\xD6\xDC"
  &gt;&gt; "ABC äöüÄÖÜ".encode("ISO-8859-1","UTF-8")
  =&gt; "ABC \xE4\xF6\xFC\xC4\xD6\xDC"
  </code></pre>
  
  <p>I am using Ruby 2.0.0 (Revision 41674) on a linux system.</p>