<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/astrotrain/tmail.rb</filename>
    </added>
    <added>
      <filename>spec/fixtures/gb2312_encoding.txt</filename>
    </added>
    <added>
      <filename>spec/fixtures/gb2312_encoding_invalid.txt</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -56,7 +56,7 @@ class Message
   end
 
   def self.parse(raw)
-    new TMail::Mail.parse(raw)
+    new Astrotrain::Mail.parse(raw)
   end
 
   def initialize(mail)</diff>
      <filename>app/models/message.rb</filename>
    </modified>
    <modified>
      <diff>@@ -16,7 +16,8 @@ Merb::Config.use do |c|
 end
  
 Merb::BootLoader.before_app_loads do
-  TMail::Mail::ALLOW_MULTIPLE['delivered-to'] = true
+  require 'astrotrain/tmail'
+  Astrotrain::Mail::ALLOW_MULTIPLE['delivered-to'] = true
   # This will get executed after dependencies have been loaded but before your app's classes have loaded.
 end
  </diff>
      <filename>config/init.rb</filename>
    </modified>
    <modified>
      <diff>@@ -111,11 +111,33 @@ describe Message do
         @raw     = mail(&quot;iso-8859-1&quot;)
         @message = Message.parse(@raw)
       end
-      
+
       it &quot;recognizes From: header with strange encoding&quot; do
         @message.sender.should == %(Matth&#233;w &lt;user@example.com&gt;)
       end
     end
+
+    describe &quot;gb2312 encoded body&quot; do
+      before :all do
+        @raw     = mail(&quot;gb2312_encoding&quot;)
+        @message = Message.parse(@raw)
+      end
+
+      it &quot;converts to UTF-8&quot; do
+        @message.body.should == &quot;Dear Sirs, \r\nWe are given to understand that you are  Manufacturer of  plstic  Bottles\r\nAdd&#65306; blah China&quot;
+      end
+    end
+
+    describe &quot;gb2312 encoded body with invalid charset in mime-version header&quot; do
+      before :all do
+        @raw     = mail(&quot;gb2312_encoding_invalid&quot;)
+        @message = Message.parse(@raw)
+      end
+
+      it &quot;converts to UTF-8&quot; do
+        @message.body.should == &quot;Dear Sirs, \r\nWe are given to understand that you are  Manufacturer of  plstic  Bottles\r\nAdd&#65306; blah China&quot;
+      end
+    end
     
     describe &quot;utf-8 encoded headers&quot; do
       before :all do</diff>
      <filename>spec/models/message_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>1b442afd28517367f073ebdef8fcefb6a92dfad1</id>
    </parent>
  </parents>
  <author>
    <name>rick</name>
    <email>technoweenie@gmail.com</email>
  </author>
  <url>http://github.com/entp/astrotrain/commit/827e038468ebff6f936430f2aa9e315ad302304c</url>
  <id>827e038468ebff6f936430f2aa9e315ad302304c</id>
  <committed-date>2009-07-06T11:45:40-07:00</committed-date>
  <authored-date>2009-07-06T11:45:40-07:00</authored-date>
  <message>handle odd cases where the charset is specified in the mime-version (wtf)</message>
  <tree>39f9d66aad504e25d813367beae3a16c2545aa83</tree>
  <committer>
    <name>rick</name>
    <email>technoweenie@gmail.com</email>
  </committer>
</commit>
