<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/transliterating_filter.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -24,9 +24,7 @@ module ActionView # :nodoc:
     # These default to 'UTF-8' and 'LATIN1' respectively. e.g.
     #
     #   @output_encoding = 'UTF-8'
-
     class CsvBuilder &lt; TemplateHandler
-
       include Compilable
 
       def self.line_offset
@@ -36,42 +34,22 @@ module ActionView # :nodoc:
       def compile(template)
         &lt;&lt;-EOV
         begin
-
           unless defined?(ActionMailer) &amp;&amp; defined?(ActionMailer::Base) &amp;&amp; controller.is_a?(ActionMailer::Base)
             @filename ||= &quot;\#{controller.action_name}.csv&quot;
             controller.response.headers[&quot;Content-Type&quot;] ||= 'text/csv'
             controller.response.headers['Content-Disposition'] = &quot;attachment; filename=\#{@filename}&quot;
           end
 
-          result = FasterCSV.generate(@csv_options || {}) do |csv|
+          FasterCSV.generate do |faster_csv|
+            csv = TransliteratingFilter.new(faster_csv)
             #{template.source}
           end
-
-          # Transliterate into the required encoding if necessary
-          # TODO: make defaults configurable
-          @input_encoding ||= 'UTF-8'
-          @output_encoding ||= 'LATIN1'
-
-          if @input_encoding == @output_encoding
-            result
-          else
-            # TODO: do some checking to make sure iconv works correctly in
-            # current environment. See ActiveSupport::Inflector#transliterate
-            # definition for details
-            #
-            # Not using the more standard //IGNORE//TRANLIST because it raises
-            # Iconv::IllegalSequence for some inputs
-            c = Iconv.new(&quot;\#{@output_encoding}//TRANSLIT//IGNORE&quot;, @input_encoding)
-            c.iconv(result)
-          end
-
         rescue Exception =&gt; e
           RAILS_DEFAULT_LOGGER.warn(&quot;Exception \#{e} \#{e.message} with class \#{e.class.name} thrown when rendering CSV&quot;)
           raise e
         end
         EOV
       end
-
     end
   end
 end</diff>
      <filename>lib/csv_builder.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>871f276ad884862c9363851464cc80ebd71e8408</id>
    </parent>
  </parents>
  <author>
    <name>Tom Stuart</name>
    <email>tom.stuart@econsultancy.com</email>
  </author>
  <url>http://github.com/DefV/csv_builder/commit/44301c848706535f63929719649b3ef69e74b676</url>
  <id>44301c848706535f63929719649b3ef69e74b676</id>
  <committed-date>2009-11-04T06:31:10-08:00</committed-date>
  <authored-date>2009-10-08T02:55:48-07:00</authored-date>
  <message>Do transliteration before exporting to CSV, not after</message>
  <tree>e775a453d3bb3b584ac3a88ba287fc50be6424f7</tree>
  <committer>
    <name>Jan De Poorter</name>
    <email>jan@defv.be</email>
  </committer>
</commit>
