<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -20,7 +20,7 @@ module GetText
 
   class PoParser &lt; Racc::Parser
 
-module_eval &lt;&lt;'..end src/poparser.ry modeval..id7a99570e05', 'src/poparser.ry', 108
+module_eval &lt;&lt;'..end src/poparser.ry modeval..ida5d3d657e2', 'src/poparser.ry', 108
   include GetText
   GetText.bindtextdomain(&quot;rgettext&quot;)
 
@@ -110,8 +110,26 @@ module_eval &lt;&lt;'..end src/poparser.ry modeval..id7a99570e05', 'src/poparser.ry',
     @comments &lt;&lt; comment
   end 
 
+  def parse_file(po_file, data, ignore_fuzzy = true)
+    args = [ po_file ]
+    # In Ruby 1.9, we must detect proper encoding of a PO file.
+    if String.instance_methods.include?(:encode)
+      encoding = detect_file_encoding(po_file)
+      args &lt;&lt; &quot;r:#{encoding}&quot;
+    end
+    parse(File.open(*args) {|io| io.read }, data, ignore_fuzzy)
+  end
 
-..end src/poparser.ry modeval..id7a99570e05
+  def detect_file_encoding(po_file)
+    open(po_file, :encoding =&gt; 'ASCII-8BIT') do |input|
+      input.lines.each do |line|
+        return Encoding.find($1) if %r[&quot;Content-Type:.*\scharset=(.*)\\n&quot;] =~ line
+      end
+    end
+    Encoding.default_external
+  end
+  private :detect_file_encoding
+..end src/poparser.ry modeval..ida5d3d657e2
 
 ##### racc 1.4.5 generates ###
 </diff>
      <filename>lib/gettext/poparser.rb</filename>
    </modified>
    <modified>
      <diff>@@ -188,27 +188,8 @@ module GetText
     mo_dir = mo_dir_rule % {:lang =&gt; lang}
     File.join(mo_dir, &quot;#{textdomain}.mo&quot;)
   end
-
-  # In Ruby 1.9, we must detect proper encoding of a PO file.
-  def po_file_content(po_file)
-    args = [ po_file ]
-    if String.instance_methods.include?(:encode)
-      encoding = detect_po_file_encoding(po_file)
-      args &lt;&lt; &quot;r:#{encoding}&quot;
-    end
-    File.open(*args) {|io| io.read }
-  end
-
-  def detect_po_file_encoding(po_file)
-    open(po_file, :encoding =&gt; 'ASCII-8BIT') do |input|
-      input.lines.each do |line|
-        return Encoding.find($1) if %r[&quot;Content-Type:.*\scharset=(.*)\\n&quot;] =~ line
-      end
-    end
-    Encoding.default_external
-  end
 end
 
 if __FILE__ == $0
   GetText.update_pofiles(&quot;foo&quot;, ARGV, &quot;foo 1.1.0&quot;)
-end
\ No newline at end of file
+end</diff>
      <filename>lib/gettext/tools.rb</filename>
    </modified>
    <modified>
      <diff>@@ -35,7 +35,7 @@ module GetText
       parser = PoParser.new
       data = MOFile.new
 
-      parser.parse(po_file_content(targetfile), data)
+      parser.parse_file(targetfile, data)
       data.save_to_file(output_path)
     end
 </diff>
      <filename>lib/gettext/tools/rmsgfmt.rb</filename>
    </modified>
    <modified>
      <diff>@@ -449,12 +449,8 @@ module GetText
       end
       
       parser = PoParser.new
-      defstr = nil
-      refstr = nil      
-      File.open(config.defpo){|f| defstr = f.read}
-      File.open(config.refpot){|f| refstr = f.read}
-      defpo = parser.parse(defstr, PoData.new, false)
-      refpot = parser.parse(refstr, PoData.new, false)
+      defpo = parser.parse_file(config.defpo, PoData.new, false)
+      refpot = parser.parse_file(config.refstrrefstr, PoData.new, false)
       
       m = Merger.new
       result = m.merge(defpo, refpot)      
@@ -499,4 +495,4 @@ if $0 == __FILE__ then
   #pp parser.parse(ARGF.read)
   
   GetText.rmsgmerge
-end
\ No newline at end of file
+end</diff>
      <filename>lib/gettext/tools/rmsgmerge.rb</filename>
    </modified>
    <modified>
      <diff>@@ -194,5 +194,23 @@ end
     @comments &lt;&lt; comment
   end 
 
+  def parse_file(po_file, data, ignore_fuzzy = true)
+    args = [ po_file ]
+    # In Ruby 1.9, we must detect proper encoding of a PO file.
+    if String.instance_methods.include?(:encode)
+      encoding = detect_file_encoding(po_file)
+      args &lt;&lt; &quot;r:#{encoding}&quot;
+    end
+    parse(File.open(*args) {|io| io.read }, data, ignore_fuzzy)
+  end
 
+  def detect_file_encoding(po_file)
+    open(po_file, :encoding =&gt; 'ASCII-8BIT') do |input|
+      input.lines.each do |line|
+        return Encoding.find($1) if %r[&quot;Content-Type:.*\scharset=(.*)\\n&quot;] =~ line
+      end
+    end
+    Encoding.default_external
+  end
+  private :detect_file_encoding
 ---- footer</diff>
      <filename>src/poparser.ry</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>e61b60e3454fc3977b7fd0f66397eed09fcc7bc8</id>
    </parent>
  </parents>
  <author>
    <name>OZAWA Sakuro</name>
    <email>github.scorpius@2238club.org</email>
  </author>
  <url>http://github.com/mutoh/gettext/commit/e8a53de767ee7381bc34ae693bb4863a530a66b0</url>
  <id>e8a53de767ee7381bc34ae693bb4863a530a66b0</id>
  <committed-date>2009-05-03T09:17:51-07:00</committed-date>
  <authored-date>2009-05-03T08:15:13-07:00</authored-date>
  <message>Add PoParser#parse_file, which parses the given file with proper encoding.

Move encoding detection stuff for Ruby 1.9 from gettext/tools.rb to PoParser.

Signed-off-by: Masao Mutoh &lt;mutoh@highway.ne.jp&gt;</message>
  <tree>f966c4886aa13b1e8ad10cc034d76cd9b8ce6c6e</tree>
  <committer>
    <name>Masao Mutoh</name>
    <email>mutoh@highway.ne.jp</email>
  </committer>
</commit>
