Author: krasnov
Date: 2007-06-24 04:16:33 -0400 (Sun, 24 Jun 2007)
New Revision: 80614

Modified:
   trunk/mcs/class/System.Web/System.Web/ChangeLog
   trunk/mcs/class/System.Web/System.Web/HttpUtility.cs
Log:
* HttpUtility.cs: fixed HtmlAttributeEncode, performance improvement


Modified: trunk/mcs/class/System.Web/System.Web/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web/ChangeLog     2007-06-24 08:09:40 UTC 
(rev 80613)
+++ trunk/mcs/class/System.Web/System.Web/ChangeLog     2007-06-24 08:16:33 UTC 
(rev 80614)
@@ -1,3 +1,7 @@
+2007-06-24  Vladimir Krasnov  <[EMAIL PROTECTED]>
+
+       * HttpUtility.cs: fixed HtmlAttributeEncode, performance improvement
+
 2007-06-20  Marek Habersack  <[EMAIL PROTECTED]>
 
        * HttpRuntime.cs: added new internal property, InternalCache, to

Modified: trunk/mcs/class/System.Web/System.Web/HttpUtility.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web/HttpUtility.cs        2007-06-24 
08:09:40 UTC (rev 80613)
+++ trunk/mcs/class/System.Web/System.Web/HttpUtility.cs        2007-06-24 
08:16:33 UTC (rev 80614)
@@ -339,7 +339,15 @@
                        if (null == s) 
                                return null;
        
-                       if (s.IndexOf ('&') == -1 && s.IndexOf ('"') == -1 && 
s.IndexOf ('<') == -1)
+                       bool needEncode = false;
+                       for (int i = 0; i < s.Length; i++) {
+                               if (s [i] == '&' || s [i] == '"' || s [i] == 
'<') {
+                                       needEncode = true;
+                                       break;
+                               }
+                       }
+
+                       if (!needEncode)
                                return s;
 
                        StringBuilder output = new StringBuilder ();

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

Reply via email to