<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: convert code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sun, 12 Oct 2008 20:15:44 GMT</pubDate>
    <description>DZone Snippets: convert code</description>
    <item>
      <title>Convert a UTF-8 string to ISO-8859-1</title>
      <link>http://snippets.dzone.com/posts/show/5019</link>
      <description>Convert a utf string to iso, used this when generating a pdf with pdf-writer in Rails, all my text is UTF8 but pdf-writer does not support this.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#add this to environment.rb&lt;br /&gt;#call to_iso on any UTF8 string to get a ISO string back&lt;br /&gt;#example : "C&#233;dez le passage aux fran&#231;ais".to_iso&lt;br /&gt;&lt;br /&gt;class String&lt;br /&gt;  require 'iconv' #this line is not needed in rails !&lt;br /&gt;  def to_iso&lt;br /&gt;    Iconv.conv('ISO-8859-1', 'utf-8', self)&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Mon, 21 Jan 2008 14:35:26 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5019</guid>
      <author>drcorbeille (Christian Meichtry)</author>
    </item>
  </channel>
</rss>
