Author: atsushi
Date: 2007-12-05 11:05:27 -0500 (Wed, 05 Dec 2007)
New Revision: 90771

Modified:
   trunk/mcs/class/System/System.Net.Mail/ChangeLog
   trunk/mcs/class/System/System.Net.Mail/MailMessage.cs
   trunk/mcs/class/System/System.Net.Mime/ChangeLog
   trunk/mcs/class/System/System.Net.Mime/ContentType.cs
   trunk/mcs/class/System/Test/System.Net.Mail/ChangeLog
   trunk/mcs/class/System/Test/System.Net.Mail/MailMessageTest.cs
Log:
2007-12-05  Atsushi Enomoto  <[EMAIL PROTECTED]>

        * ContentType.cs : for SubjectEncoding, null is returned instead of 
          ASCII (.net compat way). For this cosmetic change, BodyEncoding is 
          changed to fill ASCII automatically.

        * MailMessage.cs : fixing cosmetic .net compatibility. Automatically
          fill ASCII when guessed encoding is nothing.

        * MailMessageTest.cs : fixed test to just compare codepage. I can't
          stand with this trivial difference (w/ BOM or not) as regression,
          and fixing this "regression" causes practical bug (garbage BOM
          insertion).



Modified: trunk/mcs/class/System/System.Net.Mail/ChangeLog
===================================================================
--- trunk/mcs/class/System/System.Net.Mail/ChangeLog    2007-12-05 15:25:45 UTC 
(rev 90770)
+++ trunk/mcs/class/System/System.Net.Mail/ChangeLog    2007-12-05 16:05:27 UTC 
(rev 90771)
@@ -1,5 +1,10 @@
 2007-12-05  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
+       * MailMessage.cs : fixing cosmetic .net compatibility. Automatically
+         fill ASCII when guessed encoding is nothing.
+
+2007-12-05  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
        * SmtpClient.cs : fold base64 string at 76 characters.
          Should fix bug #344974.
 

Modified: trunk/mcs/class/System/System.Net.Mail/MailMessage.cs
===================================================================
--- trunk/mcs/class/System/System.Net.Mail/MailMessage.cs       2007-12-05 
15:25:45 UTC (rev 90770)
+++ trunk/mcs/class/System/System.Net.Mail/MailMessage.cs       2007-12-05 
16:05:27 UTC (rev 90771)
@@ -131,7 +131,7 @@
                        set {
                                // autodetect suitable body encoding (ASCII or 
UTF-8), if it is not initialized yet.
                                if (value != null && bodyEncoding == null)
-                                       bodyEncoding = GuessEncoding (value);
+                                       bodyEncoding = GuessEncoding (value) ?? 
Encoding.ASCII;
                                body = value;
                        }
                }

Modified: trunk/mcs/class/System/System.Net.Mime/ChangeLog
===================================================================
--- trunk/mcs/class/System/System.Net.Mime/ChangeLog    2007-12-05 15:25:45 UTC 
(rev 90770)
+++ trunk/mcs/class/System/System.Net.Mime/ChangeLog    2007-12-05 16:05:27 UTC 
(rev 90771)
@@ -1,5 +1,11 @@
 2007-12-05  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
+       * ContentType.cs : for SubjectEncoding, null is returned instead of 
+         ASCII (.net compat way). For this cosmetic change, BodyEncoding is 
+         changed to fill ASCII automatically.
+
+2007-12-05  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
        * ContentType.cs : added GuessTransferEncoding() to guess correct
          encoding type for sys.net.mail.Attachment.
          Here UTF8Encoding should not include BOM.

Modified: trunk/mcs/class/System/System.Net.Mime/ContentType.cs
===================================================================
--- trunk/mcs/class/System/System.Net.Mime/ContentType.cs       2007-12-05 
15:25:45 UTC (rev 90770)
+++ trunk/mcs/class/System/System.Net.Mime/ContentType.cs       2007-12-05 
16:05:27 UTC (rev 90771)
@@ -188,7 +188,7 @@
                        for (int i = 0; i < s.Length; i++)
                                if (s [i] >= '\u0080')
                                        return UTF8Unmarked;
-                       return Encoding.ASCII;
+                       return null;
                }
 
                internal static TransferEncoding GuessTransferEncoding 
(Encoding enc)

Modified: trunk/mcs/class/System/Test/System.Net.Mail/ChangeLog
===================================================================
--- trunk/mcs/class/System/Test/System.Net.Mail/ChangeLog       2007-12-05 
15:25:45 UTC (rev 90770)
+++ trunk/mcs/class/System/Test/System.Net.Mail/ChangeLog       2007-12-05 
16:05:27 UTC (rev 90771)
@@ -1,3 +1,10 @@
+2007-12-05  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
+       * MailMessageTest.cs : fixed test to just compare codepage. I can't
+         stand with this trivial difference (w/ BOM or not) as regression,
+         and fixing this "regression" causes practical bug (garbage BOM
+         insertion).
+
 2007-11-05  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
        * AlternateViewTest.cs : added test for CreateAlternateViewFromString

Modified: trunk/mcs/class/System/Test/System.Net.Mail/MailMessageTest.cs
===================================================================
--- trunk/mcs/class/System/Test/System.Net.Mail/MailMessageTest.cs      
2007-12-05 15:25:45 UTC (rev 90770)
+++ trunk/mcs/class/System/Test/System.Net.Mail/MailMessageTest.cs      
2007-12-05 16:05:27 UTC (rev 90771)
@@ -147,7 +147,7 @@
                        Assert.AreEqual (Encoding.ASCII, msg.BodyEncoding, 
"#3");
                        msg.BodyEncoding = null;
                        msg.Body = "test\u3067\u3059";
-                       Assert.AreEqual (Encoding.UTF8, msg.BodyEncoding, "#4");
+                       Assert.AreEqual (Encoding.UTF8.CodePage, 
msg.BodyEncoding.CodePage, "#4");
                }
 
                [Test]
@@ -156,12 +156,12 @@
                        MailMessage msg = new MailMessage ("[EMAIL PROTECTED]", 
"[EMAIL PROTECTED]");
                        Assert.AreEqual (null, msg.SubjectEncoding, "#1");
                        msg.Subject = "test";
-                       Assert.AreEqual (Encoding.ASCII, msg.SubjectEncoding, 
"#2");
+                       Assert.AreEqual (null, msg.SubjectEncoding, "#2");
                        msg.Subject = "test\u3067\u3059";
-                       Assert.AreEqual (Encoding.ASCII, msg.SubjectEncoding, 
"#3");
+                       Assert.AreEqual (Encoding.UTF8.CodePage, 
msg.SubjectEncoding.CodePage, "#3");
                        msg.SubjectEncoding = null;
                        msg.Subject = "test\u3067\u3059";
-                       Assert.AreEqual (Encoding.UTF8, msg.SubjectEncoding, 
"#4");
+                       Assert.AreEqual (Encoding.UTF8.CodePage, 
msg.SubjectEncoding.CodePage, "#4");
                }
        }
 }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to