Author: atsushi
Date: 2007-12-06 09:22:51 -0500 (Thu, 06 Dec 2007)
New Revision: 90809

Modified:
   trunk/mcs/class/System/System.Net.Mail/AlternateView.cs
   trunk/mcs/class/System/System.Net.Mail/ChangeLog
   trunk/mcs/class/System/System.Net.Mail/SmtpClient.cs
Log:
2007-12-06  Atsushi Enomoto  <[EMAIL PROTECTED]>

        * AlternateView.cs : supply charset info for ContentType.
        * SmtpClient.cs : for ToQuotedPrintable() input, don't use utf8
          StreamReader to get input string. Just use Encoding.GetBytes().
          Fixed bug #346162.



Modified: trunk/mcs/class/System/System.Net.Mail/AlternateView.cs
===================================================================
--- trunk/mcs/class/System/System.Net.Mail/AlternateView.cs     2007-12-06 
14:14:36 UTC (rev 90808)
+++ trunk/mcs/class/System/System.Net.Mail/AlternateView.cs     2007-12-06 
14:22:51 UTC (rev 90809)
@@ -120,7 +120,10 @@
                        if (encoding == null)
                                encoding = Encoding.UTF8;
                        MemoryStream ms = new MemoryStream (encoding.GetBytes 
(content));
-                       AlternateView av = new AlternateView (ms, mediaType);
+                       ContentType ct = new ContentType ();
+                       ct.MediaType = mediaType;
+                       ct.CharSet = encoding.HeaderName;
+                       AlternateView av = new AlternateView (ms, ct);
                        av.TransferEncoding = TransferEncoding.QuotedPrintable;
                        return av;
                }

Modified: trunk/mcs/class/System/System.Net.Mail/ChangeLog
===================================================================
--- trunk/mcs/class/System/System.Net.Mail/ChangeLog    2007-12-06 14:14:36 UTC 
(rev 90808)
+++ trunk/mcs/class/System/System.Net.Mail/ChangeLog    2007-12-06 14:22:51 UTC 
(rev 90809)
@@ -1,3 +1,10 @@
+2007-12-06  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
+       * AlternateView.cs : supply charset info for ContentType.
+       * SmtpClient.cs : for ToQuotedPrintable() input, don't use utf8
+         StreamReader to get input string. Just use Encoding.GetBytes().
+         Fixed bug #346162.
+
 2007-12-05  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
        * MailMessage.cs : fixing cosmetic .net compatibility. Automatically

Modified: trunk/mcs/class/System/System.Net.Mail/SmtpClient.cs
===================================================================
--- trunk/mcs/class/System/System.Net.Mail/SmtpClient.cs        2007-12-06 
14:14:36 UTC (rev 90808)
+++ trunk/mcs/class/System/System.Net.Mail/SmtpClient.cs        2007-12-06 
14:22:51 UTC (rev 90809)
@@ -774,9 +774,9 @@
 #endif
                                        break;
                                case TransferEncoding.QuotedPrintable:
-                                       StreamReader sr = new StreamReader 
(av.ContentStream);
-                                       Encoding encoding = contentType.CharSet 
!= null ? Encoding.GetEncoding (contentType.CharSet) : Encoding.ASCII;
-                                       SendData (ToQuotedPrintable 
(sr.ReadToEnd (), encoding));
+                                       byte [] bytes = new byte 
[av.ContentStream.Length];
+                                       av.ContentStream.Read (bytes, 0, 
bytes.Length);
+                                       SendData (ToQuotedPrintable (bytes));
                                        break;
                                case TransferEncoding.SevenBit:
                                case TransferEncoding.Unknown:
@@ -818,9 +818,9 @@
 #endif
                                        break;
                                case TransferEncoding.QuotedPrintable:
-                                       StreamReader sr = new StreamReader 
(lr.ContentStream);
-                                       Encoding encoding = contentType.CharSet 
!= null ? Encoding.GetEncoding (contentType.CharSet) : Encoding.ASCII;
-                                       SendData (ToQuotedPrintable 
(sr.ReadToEnd (), encoding));
+                                       byte [] bytes = new byte 
[lr.ContentStream.Length];
+                                       lr.ContentStream.Read (bytes, 0, 
bytes.Length);
+                                       SendData (ToQuotedPrintable (bytes));
                                        break;
                                case TransferEncoding.SevenBit:
                                case TransferEncoding.Unknown:
@@ -853,9 +853,9 @@
 #endif
                                        break;
                                case TransferEncoding.QuotedPrintable:
-                                       StreamReader sr = new StreamReader 
(att.ContentStream);
-                                       Encoding encoding = contentType.CharSet 
!= null ? Encoding.GetEncoding (contentType.CharSet) : Encoding.ASCII;
-                                       SendData (ToQuotedPrintable 
(sr.ReadToEnd (), encoding));
+                                       byte [] bytes = new byte 
[att.ContentStream.Length];
+                                       att.ContentStream.Read (bytes, 0, 
bytes.Length);
+                                       SendData (ToQuotedPrintable (bytes));
                                        break;
                                case TransferEncoding.SevenBit:
                                case TransferEncoding.Unknown:

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

Reply via email to