+2007-03-13 Igor Zelmanovich <igorz@mainsoft.com>
+
+ * HttpUtility.cs: fixed HttpUtillity.HtmlAttributeEncode
+ '<' char must be encoded.
+
2007-03-12 Vladimir Krasnov <vladimirk@mainsoft.com>
* CapabilitiesLoader.cs: added TARGET_JVM part of static members,
* HttpUtility.cs: fix InvalidCastException.
-2005-06-05 Kornél Pál <kornelpal@hotmail.com>
+2005-06-05 Korn__l P__l <kornelpal@hotmail.com>
* HttpWriter.cs: Fixed: _OutputFilter.Close () was called twice.
if (null == s)
return null;
- if (s.IndexOf ('&') == -1 && s.IndexOf ('"') == -1)
+ if (s.IndexOf ('&') == -1 && s.IndexOf ('"') == -1 && s.IndexOf ('<') == -1)
return s;
StringBuilder output = new StringBuilder ();
case '"' :
output.Append (""");
break;
+ case '<':
+ output.Append ("<");
+ break;
default:
output.Append (c);
break;
[TestFixture]
public class HttpUtilityTest {
+ [Test]
+ public void HtmlAttributeEncode ()
+ {
+ Assert.AreEqual ("<script>", HttpUtility.HtmlAttributeEncode ("<script>"));
+ Assert.AreEqual (""a&b"", HttpUtility.HtmlAttributeEncode ("\"a&b\""));
+ Assert.AreEqual ("'string'", HttpUtility.HtmlAttributeEncode ("'string'"));
+ }
+
[Test]
public void HtmlEncode_LtGt ()
{