<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Working with UTF-8 in PDF::Writer and Ruby on Rails</title>
	<atom:link href="http://www.peterkrantz.com/2007/utf8-in-pdf-writer/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.peterkrantz.com/2007/utf8-in-pdf-writer/</link>
	<description></description>
	<lastBuildDate>Thu, 26 Jan 2012 09:31:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: &#1493;&#1497;&#1500;&#1493;&#1504;&#1493;&#1514; &#1502;&#1506;&#1493;&#1510;&#1489;&#1497;&#1501;&#124;&#1493;&#1497;&#1500;&#1493;&#1504;&#1493;&#1514;&#124;&#1493;&#1497;&#1500;&#1493;&#1504;&#1493;&#1514; &#1502;&#1491;&#1492;&#1497;&#1502;&#1497;&#1501;&#124; &#14</title>
		<link>http://www.peterkrantz.com/2007/utf8-in-pdf-writer/comment-page-1/#comment-2964</link>
		<dc:creator>&#1493;&#1497;&#1500;&#1493;&#1504;&#1493;&#1514; &#1502;&#1506;&#1493;&#1510;&#1489;&#1497;&#1501;&#124;&#1493;&#1497;&#1500;&#1493;&#1504;&#1493;&#1514;&#124;&#1493;&#1497;&#1500;&#1493;&#1504;&#1493;&#1514; &#1502;&#1491;&#1492;&#1497;&#1502;&#1497;&#1501;&#124; &#14</dc:creator>
		<pubDate>Mon, 17 Oct 2011 18:15:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.peterkrantz.com/2007/utf8-in-pdf-writer/#comment-2964</guid>
		<description>&lt;strong&gt;&#1493;&#1497;&#1500;&#1493;&#1504;&#1493;&#1514; &#1502;&#1506;&#1493;&#1510;&#1489;&#1497;&#1501;&#124;&#1493;&#1497;&#1500;&#1493;&#1504;&#1493;&#1514;&#124;&#1493;&#1497;&#1500;&#1493;&#1504;&#1493;&#1514; &#1502;&#1491;&#1492;&#1497;&#1502;&#1497;&#1501;&#124;...&lt;/strong&gt;

[...]Working with UTF-8 in PDF::Writer and Ruby on Rails - Peter Krantz[...]...</description>
		<content:encoded><![CDATA[<p><strong>&#1493;&#1497;&#1500;&#1493;&#1504;&#1493;&#1514; &#1502;&#1506;&#1493;&#1510;&#1489;&#1497;&#1501;|&#1493;&#1497;&#1500;&#1493;&#1504;&#1493;&#1514;|&#1493;&#1497;&#1500;&#1493;&#1504;&#1493;&#1514; &#1502;&#1491;&#1492;&#1497;&#1502;&#1497;&#1501;|&#8230;</strong></p>
<p>[...]Working with UTF-8 in PDF::Writer and Ruby on Rails &#8211; Peter Krantz[...]&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Verschoor</title>
		<link>http://www.peterkrantz.com/2007/utf8-in-pdf-writer/comment-page-1/#comment-3051</link>
		<dc:creator>Paul Verschoor</dc:creator>
		<pubDate>Tue, 05 Oct 2010 16:12:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.peterkrantz.com/2007/utf8-in-pdf-writer/#comment-3051</guid>
		<description>CONVERTER = Iconv.new( &#039;ISO-8859-15//IGNORE//TRANSLIT&#039;, &#039;utf-8&#039;)

module PDF
  class Writer
    alias_method :old_add_text, :add_text

    def add_text(x,y,textto,size,angle,word_space_adjust)
      old_add_text(x,y,CONVERTER.iconv(textto), size,angle,word_space_adjust)
    end

  end
end</description>
		<content:encoded><![CDATA[<p>CONVERTER = Iconv.new( &#8216;ISO-8859-15//IGNORE//TRANSLIT&#8217;, &#8216;utf-8&#8242;)</p>
<p>module PDF<br />
  class Writer<br />
    alias_method :old_add_text, :add_text</p>
<p>    def add_text(x,y,textto,size,angle,word_space_adjust)<br />
      old_add_text(x,y,CONVERTER.iconv(textto), size,angle,word_space_adjust)<br />
    end</p>
<p>  end<br />
end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Guillaume</title>
		<link>http://www.peterkrantz.com/2007/utf8-in-pdf-writer/comment-page-1/#comment-2565</link>
		<dc:creator>Guillaume</dc:creator>
		<pubDate>Thu, 18 Jun 2009 17:25:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.peterkrantz.com/2007/utf8-in-pdf-writer/#comment-2565</guid>
		<description>Thank you very much :-)</description>
		<content:encoded><![CDATA[<p>Thank you very much :-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fguillen</title>
		<link>http://www.peterkrantz.com/2007/utf8-in-pdf-writer/comment-page-1/#comment-2560</link>
		<dc:creator>fguillen</dc:creator>
		<pubDate>Thu, 28 May 2009 12:48:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.peterkrantz.com/2007/utf8-in-pdf-writer/#comment-2560</guid>
		<description>Just what I needed :).. it works!</description>
		<content:encoded><![CDATA[<p>Just what I needed :).. it works!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan Kroes</title>
		<link>http://www.peterkrantz.com/2007/utf8-in-pdf-writer/comment-page-1/#comment-2455</link>
		<dc:creator>Stefan Kroes</dc:creator>
		<pubDate>Thu, 12 Feb 2009 07:51:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.peterkrantz.com/2007/utf8-in-pdf-writer/#comment-2455</guid>
		<description>Thanks dude!! I was googling for almost half an hour before I found your article. My accented characters finally look right in my pdf document!</description>
		<content:encoded><![CDATA[<p>Thanks dude!! I was googling for almost half an hour before I found your article. My accented characters finally look right in my pdf document!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Exporting from Rails to Excel &#171; Coding is like gardening&#8230;</title>
		<link>http://www.peterkrantz.com/2007/utf8-in-pdf-writer/comment-page-1/#comment-2454</link>
		<dc:creator>Exporting from Rails to Excel &#171; Coding is like gardening&#8230;</dc:creator>
		<pubDate>Tue, 03 Feb 2009 13:57:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.peterkrantz.com/2007/utf8-in-pdf-writer/#comment-2454</guid>
		<description>[...] to export data as CSV Working with UTF-8 in PDF::Writer and Ruby on Rails Iconv Ruby [...]</description>
		<content:encoded><![CDATA[<p>[...] to export data as CSV Working with UTF-8 in PDF::Writer and Ruby on Rails Iconv Ruby [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan Heneise</title>
		<link>http://www.peterkrantz.com/2007/utf8-in-pdf-writer/comment-page-1/#comment-2450</link>
		<dc:creator>Ryan Heneise</dc:creator>
		<pubDate>Sun, 25 Jan 2009 19:25:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.peterkrantz.com/2007/utf8-in-pdf-writer/#comment-2450</guid>
		<description>Worked for me as well - thanks for posting this solution! I&#039;m subscribing in hopes of seeing something about your experiences with Prawn.</description>
		<content:encoded><![CDATA[<p>Worked for me as well &#8211; thanks for posting this solution! I&#8217;m subscribing in hopes of seeing something about your experiences with Prawn.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick Hall</title>
		<link>http://www.peterkrantz.com/2007/utf8-in-pdf-writer/comment-page-1/#comment-2414</link>
		<dc:creator>Patrick Hall</dc:creator>
		<pubDate>Mon, 08 Dec 2008 16:55:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.peterkrantz.com/2007/utf8-in-pdf-writer/#comment-2414</guid>
		<description>&quot;The solution is to switch encoding back to ISO-8859-15 for text strings you feed to PDF::Writer.&quot;

How is this a solution to working with UTF-8 in PDF::Writer and Rails?

It&#039;s a way of *not* working with UTF-8 in PDF::Writer and Rails.</description>
		<content:encoded><![CDATA[<p>&#8220;The solution is to switch encoding back to ISO-8859-15 for text strings you feed to PDF::Writer.&#8221;</p>
<p>How is this a solution to working with UTF-8 in PDF::Writer and Rails?</p>
<p>It&#8217;s a way of *not* working with UTF-8 in PDF::Writer and Rails.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy</title>
		<link>http://www.peterkrantz.com/2007/utf8-in-pdf-writer/comment-page-1/#comment-2314</link>
		<dc:creator>Andy</dc:creator>
		<pubDate>Mon, 08 Sep 2008 13:27:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.peterkrantz.com/2007/utf8-in-pdf-writer/#comment-2314</guid>
		<description>@gpm

No solution, I&#039;m re-writing using prawn. The folks around it&#039;s google group are wonderfully helpful, and I look forward to an easier syntax. Cheers</description>
		<content:encoded><![CDATA[<p>@gpm</p>
<p>No solution, I&#8217;m re-writing using prawn. The folks around it&#8217;s google group are wonderfully helpful, and I look forward to an easier syntax. Cheers</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rails PDF Plugin unter Rails2.1 &#124; Code Schubser</title>
		<link>http://www.peterkrantz.com/2007/utf8-in-pdf-writer/comment-page-1/#comment-2308</link>
		<dc:creator>Rails PDF Plugin unter Rails2.1 &#124; Code Schubser</dc:creator>
		<pubDate>Tue, 19 Aug 2008 16:05:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.peterkrantz.com/2007/utf8-in-pdf-writer/#comment-2308</guid>
		<description>[...] übrigens im PDF Dokument mit UTF-8 arbeiten will, sollte mal bei Peter Krantz [...]</description>
		<content:encoded><![CDATA[<p>[...] übrigens im PDF Dokument mit UTF-8 arbeiten will, sollte mal bei Peter Krantz [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gpm</title>
		<link>http://www.peterkrantz.com/2007/utf8-in-pdf-writer/comment-page-1/#comment-2306</link>
		<dc:creator>gpm</dc:creator>
		<pubDate>Thu, 14 Aug 2008 00:41:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.peterkrantz.com/2007/utf8-in-pdf-writer/#comment-2306</guid>
		<description>The PDF::Writer newsgroup brings this up briefly (http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/ff2b849a9fc39a2b).  It sounds like you need to convert to UTF-16 and specify a UxFEFF BOM before text string (or, as i understand it, the string must start with the bytes 254 then 255).

I tried adding this to the solution here (http://pastie.org/252651) but it looks like the pdf is still rendering latin characters with the 254 and 255 bytes being rendered and prepended to everything.

Please post if you get this working!  Another alternative is to move over to prawn, which appears to support UTF-8 out of the box.</description>
		<content:encoded><![CDATA[<p>The PDF::Writer newsgroup brings this up briefly (<a href="http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/ff2b849a9fc39a2b" rel="nofollow">http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/ff2b849a9fc39a2b</a>).  It sounds like you need to convert to UTF-16 and specify a UxFEFF BOM before text string (or, as i understand it, the string must start with the bytes 254 then 255).</p>
<p>I tried adding this to the solution here (<a href="http://pastie.org/252651" rel="nofollow">http://pastie.org/252651</a>) but it looks like the pdf is still rendering latin characters with the 254 and 255 bytes being rendered and prepended to everything.</p>
<p>Please post if you get this working!  Another alternative is to move over to prawn, which appears to support UTF-8 out of the box.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy</title>
		<link>http://www.peterkrantz.com/2007/utf8-in-pdf-writer/comment-page-1/#comment-2300</link>
		<dc:creator>Andy</dc:creator>
		<pubDate>Thu, 31 Jul 2008 20:19:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.peterkrantz.com/2007/utf8-in-pdf-writer/#comment-2300</guid>
		<description>Are there any ideas or techniques floating around here about how to do this if one is &lt;i&gt;&lt;b&gt;not&lt;/b&gt;&lt;/i&gt; only using Latin characters with diacritics?  I have japanese utf-8 that has to go into PDF::Writer.  Maybe I need to learn how to manipulate strings at a lower level or understand unicode more thoroughly, but here&#039;s what I&#039;ve got so far -   

Currently in PDF::Writer:
Iconv.conv(&#039;utf-16BE&#039;, &#039;utf-8&#039;, &#039;ローラー&#039;) ==&gt;  0í0ü0é0ü

While irb:
Iconv.conv(&#039;utf-16BE&#039;, &#039;utf-8&#039;, &#039;ローラー&#039;) ==&gt; &quot;0\3550\3740\3510\374&quot;</description>
		<content:encoded><![CDATA[<p>Are there any ideas or techniques floating around here about how to do this if one is <i><b>not</b></i> only using Latin characters with diacritics?  I have japanese utf-8 that has to go into PDF::Writer.  Maybe I need to learn how to manipulate strings at a lower level or understand unicode more thoroughly, but here&#8217;s what I&#8217;ve got so far &#8211;   </p>
<p>Currently in PDF::Writer:<br />
Iconv.conv(&#8216;utf-16BE&#8217;, &#8216;utf-8&#8242;, &#8216;ローラー&#8217;) ==&gt;  0í0ü0é0ü</p>
<p>While irb:<br />
Iconv.conv(&#8216;utf-16BE&#8217;, &#8216;utf-8&#8242;, &#8216;ローラー&#8217;) ==&gt; &#8220;0\3550\3740\3510\374&#8243;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Boris</title>
		<link>http://www.peterkrantz.com/2007/utf8-in-pdf-writer/comment-page-1/#comment-2280</link>
		<dc:creator>Boris</dc:creator>
		<pubDate>Tue, 24 Jun 2008 13:51:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.peterkrantz.com/2007/utf8-in-pdf-writer/#comment-2280</guid>
		<description>I also ran into the recursion error &quot;stack level too deep&quot; and resolved it like this:

alias_method :old_add_text, :add_text unless method_defined?(:old_add_text)

This prevents the method to be overridden more often than once.

Cheers,
boris</description>
		<content:encoded><![CDATA[<p>I also ran into the recursion error &#8220;stack level too deep&#8221; and resolved it like this:</p>
<p>alias_method :old_add_text, :add_text unless method_defined?(:old_add_text)</p>
<p>This prevents the method to be overridden more often than once.</p>
<p>Cheers,<br />
boris</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: BuGo</title>
		<link>http://www.peterkrantz.com/2007/utf8-in-pdf-writer/comment-page-1/#comment-2263</link>
		<dc:creator>BuGo</dc:creator>
		<pubDate>Thu, 15 May 2008 15:34:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.peterkrantz.com/2007/utf8-in-pdf-writer/#comment-2263</guid>
		<description>Am i the only one who gets :

stack level too deep

?</description>
		<content:encoded><![CDATA[<p>Am i the only one who gets :</p>
<p>stack level too deep</p>
<p>?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Erik L. Underbjerg</title>
		<link>http://www.peterkrantz.com/2007/utf8-in-pdf-writer/comment-page-1/#comment-2247</link>
		<dc:creator>Erik L. Underbjerg</dc:creator>
		<pubDate>Wed, 23 Apr 2008 14:35:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.peterkrantz.com/2007/utf8-in-pdf-writer/#comment-2247</guid>
		<description>Brilliant! This was just what I needed :-)</description>
		<content:encoded><![CDATA[<p>Brilliant! This was just what I needed :-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kikito and fjuan</title>
		<link>http://www.peterkrantz.com/2007/utf8-in-pdf-writer/comment-page-1/#comment-2236</link>
		<dc:creator>kikito and fjuan</dc:creator>
		<pubDate>Fri, 28 Mar 2008 15:50:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.peterkrantz.com/2007/utf8-in-pdf-writer/#comment-2236</guid>
		<description>We love you</description>
		<content:encoded><![CDATA[<p>We love you</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kai</title>
		<link>http://www.peterkrantz.com/2007/utf8-in-pdf-writer/comment-page-1/#comment-2166</link>
		<dc:creator>Kai</dc:creator>
		<pubDate>Fri, 21 Dec 2007 13:48:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.peterkrantz.com/2007/utf8-in-pdf-writer/#comment-2166</guid>
		<description>&lt;code&gt;
def add_text(x, y, text, *args)
  old_add_text(x,y,ICONV_CONVERTER.iconv(text), *args)
end
&lt;/code&gt;

does not work with Time objects. The trick is to call iconv with text.to_s instead of just text. Then you are able to print dates (for example to put Time.now in the page footer).</description>
		<content:encoded><![CDATA[<pre class="brush: plain; title: ; notranslate">DQpkZWYgYWRkX3RleHQoeCwgeSwgdGV4dCwgKmFyZ3MpDQogIG9sZF9hZGRfdGV4dCh4LHksSUNPTlZfQ09OVkVSVEVSLmljb252KHRleHQpLCAqYXJncykNCmVuZA0K</pre>
<p>does not work with Time objects. The trick is to call iconv with text.to_s instead of just text. Then you are able to print dates (for example to put Time.now in the page footer).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pete</title>
		<link>http://www.peterkrantz.com/2007/utf8-in-pdf-writer/comment-page-1/#comment-2137</link>
		<dc:creator>Pete</dc:creator>
		<pubDate>Thu, 06 Dec 2007 18:05:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.peterkrantz.com/2007/utf8-in-pdf-writer/#comment-2137</guid>
		<description>I want to add that its better to use the method &quot;add_text&quot; instead of &quot;text&quot; because SimpleTable uses &quot;add_text&quot; and &quot;text&quot; uses &quot;add_text&quot; internally.</description>
		<content:encoded><![CDATA[<p>I want to add that its better to use the method &#8220;add_text&#8221; instead of &#8220;text&#8221; because SimpleTable uses &#8220;add_text&#8221; and &#8220;text&#8221; uses &#8220;add_text&#8221; internally.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pete</title>
		<link>http://www.peterkrantz.com/2007/utf8-in-pdf-writer/comment-page-1/#comment-2136</link>
		<dc:creator>Pete</dc:creator>
		<pubDate>Thu, 06 Dec 2007 16:09:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.peterkrantz.com/2007/utf8-in-pdf-writer/#comment-2136</guid>
		<description>I have a small question: Why is the converter a constant?</description>
		<content:encoded><![CDATA[<p>I have a small question: Why is the converter a constant?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pete</title>
		<link>http://www.peterkrantz.com/2007/utf8-in-pdf-writer/comment-page-1/#comment-2118</link>
		<dc:creator>Pete</dc:creator>
		<pubDate>Thu, 29 Nov 2007 13:27:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.peterkrantz.com/2007/utf8-in-pdf-writer/#comment-2118</guid>
		<description>Thank you for this little patch that help me much! :)</description>
		<content:encoded><![CDATA[<p>Thank you for this little patch that help me much! :)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced

Served from: www.peterkrantz.com @ 2012-02-09 06:50:43 -->
