f3e3aab35a
Former-commit-id: 9c2cb47f45fa221e661ab616387c9cda183f283d
820 lines
51 KiB
C#
820 lines
51 KiB
C#
//
|
||
// System.Web.HttpUtilityTest.cs - Unit tests for System.Web.HttpUtility
|
||
//
|
||
// Author:
|
||
// Sebastien Pouliot <sebastien@ximian.com>
|
||
//
|
||
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
|
||
//
|
||
// Permission is hereby granted, free of charge, to any person obtaining
|
||
// a copy of this software and associated documentation files (the
|
||
// "Software"), to deal in the Software without restriction, including
|
||
// without limitation the rights to use, copy, modify, merge, publish,
|
||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||
// permit persons to whom the Software is furnished to do so, subject to
|
||
// the following conditions:
|
||
//
|
||
// The above copyright notice and this permission notice shall be
|
||
// included in all copies or substantial portions of the Software.
|
||
//
|
||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||
//
|
||
|
||
using System;
|
||
using System.Text;
|
||
using System.Web;
|
||
using System.IO;
|
||
using System.Collections.Specialized;
|
||
|
||
using NUnit.Framework;
|
||
using MonoTests.Common;
|
||
|
||
namespace MonoTests.System.Web {
|
||
|
||
[TestFixture]
|
||
public class HttpUtilityTest
|
||
{
|
||
|
||
[Test]
|
||
public void HtmlAttributeEncode ()
|
||
{
|
||
Assert.AreEqual (null, HttpUtility.HtmlAttributeEncode (null), "#A1");
|
||
Assert.AreEqual (String.Empty, HttpUtility.HtmlAttributeEncode (String.Empty), "#A2");
|
||
Assert.AreEqual ("<script>", HttpUtility.HtmlAttributeEncode ("<script>"), "#A3");
|
||
Assert.AreEqual (""a&b"", HttpUtility.HtmlAttributeEncode ("\"a&b\""), "#A4");
|
||
Assert.AreEqual ("'string'", HttpUtility.HtmlAttributeEncode ("'string'"), "#A5");
|
||
}
|
||
|
||
[Test]
|
||
public void HtmlAttributeEncode_String_TextWriter ()
|
||
{
|
||
var sw = new StringWriter ();
|
||
AssertExtensions.Throws<ArgumentNullException> (() => {
|
||
HttpUtility.HtmlAttributeEncode ("string", null);
|
||
}, "#A1");
|
||
|
||
HttpUtility.HtmlAttributeEncode ("<script>", sw);
|
||
Assert.AreEqual ("<script>", sw.ToString (), "#A2");
|
||
|
||
sw = new StringWriter ();
|
||
HttpUtility.HtmlAttributeEncode ("\"a&b\"", sw);
|
||
Assert.AreEqual (""a&b"", sw.ToString (), "#A3");
|
||
|
||
sw = new StringWriter ();
|
||
HttpUtility.HtmlAttributeEncode ("'string'", sw);
|
||
Assert.AreEqual ("'string'", sw.ToString (), "#A4");
|
||
sw = new StringWriter ();
|
||
HttpUtility.HtmlAttributeEncode ("\\string\\", sw);
|
||
Assert.AreEqual ("\\string\\", sw.ToString (), "#A5");
|
||
|
||
sw = new StringWriter ();
|
||
HttpUtility.HtmlAttributeEncode (String.Empty, sw);
|
||
Assert.AreEqual (String.Empty, sw.ToString (), "#A6");
|
||
|
||
sw = new StringWriter ();
|
||
HttpUtility.HtmlAttributeEncode (null, sw);
|
||
Assert.AreEqual (String.Empty, sw.ToString (), "#A7");
|
||
}
|
||
|
||
[Test]
|
||
public void HtmlDecode ()
|
||
{
|
||
Assert.AreEqual (null, HttpUtility.HtmlDecode (null), "#A1");
|
||
Assert.AreEqual (String.Empty, HttpUtility.HtmlDecode (String.Empty), "#A2");
|
||
|
||
for (int i = 0; i < decoding_pairs.Length; i += 2)
|
||
Assert.AreEqual (decoding_pairs [i + 1], HttpUtility.HtmlDecode (decoding_pairs [i]), "#B" + (i / 2).ToString ());
|
||
}
|
||
|
||
[Test]
|
||
public void HtmlDecode_String_TextWriter ()
|
||
{
|
||
StringWriter sw;
|
||
AssertExtensions.Throws<ArgumentNullException> (() => {
|
||
HttpUtility.HtmlDecode ("string", null);
|
||
}, "#A1");
|
||
|
||
sw = new StringWriter ();
|
||
HttpUtility.HtmlDecode (null, sw);
|
||
Assert.AreEqual (String.Empty, sw.ToString (), "#A2");
|
||
|
||
sw = new StringWriter ();
|
||
HttpUtility.HtmlDecode (String.Empty, sw);
|
||
Assert.AreEqual (String.Empty, sw.ToString (), "#A3");
|
||
|
||
for (int i = 0; i < decoding_pairs.Length; i += 2) {
|
||
sw = new StringWriter ();
|
||
HttpUtility.HtmlDecode (decoding_pairs [i], sw);
|
||
Assert.AreEqual (decoding_pairs [i + 1], sw.ToString (), "#B" + (i / 2).ToString ());
|
||
}
|
||
}
|
||
|
||
[Test]
|
||
public void HtmlEncode_LtGt ()
|
||
{
|
||
Assert.AreEqual ("<script>", HttpUtility.HtmlEncode ("<script>"));
|
||
}
|
||
|
||
// Notes:
|
||
// * this is to avoid a regression that would cause Mono to
|
||
// fail item #3 of the XSS vulnerabilities listed at:
|
||
// http://it-project.ru/andir/docs/aspxvuln/aspxvuln.en.xml
|
||
// we didn't fall the first time so let's ensure we never will
|
||
// * The author notes that Microsoft has decided not to fix
|
||
// this issue (hence the NotDotNet category).
|
||
|
||
[Test]
|
||
[Category ("NotDotNet")]
|
||
public void HtmlEncode_XSS ()
|
||
{
|
||
string problem = "\xff1cscript\xff1e"; // unicode looks alike <script>
|
||
byte [] utf8data = Encoding.UTF8.GetBytes (problem);
|
||
Encoding win1251 = Encoding.GetEncoding ("windows-1251");
|
||
byte [] windata = Encoding.Convert (Encoding.UTF8, win1251, utf8data);
|
||
// now it's a real problem
|
||
Assert.AreEqual ("<script>", Encoding.ASCII.GetString (windata), "<script>");
|
||
|
||
string encoded = HttpUtility.HtmlEncode (problem);
|
||
Assert.AreEqual ("<script>", encoded, "<script>");
|
||
|
||
utf8data = Encoding.UTF8.GetBytes (encoded);
|
||
windata = Encoding.Convert (Encoding.UTF8, win1251, utf8data);
|
||
Assert.AreEqual ("<script>", Encoding.ASCII.GetString (windata), "ok");
|
||
}
|
||
[Test]
|
||
public void JavaScriptStringEncode ()
|
||
{
|
||
Assert.AreEqual (String.Empty, HttpUtility.JavaScriptStringEncode (null), "#A1");
|
||
Assert.AreEqual ("\"\"", HttpUtility.JavaScriptStringEncode (null, true), "#A2");
|
||
Assert.AreEqual (String.Empty, HttpUtility.JavaScriptStringEncode (String.Empty), "#A3");
|
||
Assert.AreEqual ("\"\"", HttpUtility.JavaScriptStringEncode (String.Empty, true), "#A4");
|
||
|
||
for (char c = char.MinValue; c < char.MaxValue; c++) {
|
||
string exp = JavaScriptStringEncode (c.ToString (), false);
|
||
string expQuoted = JavaScriptStringEncode (c.ToString (), true);
|
||
string act = HttpUtility.JavaScriptStringEncode (c.ToString ());
|
||
string actQuoted = HttpUtility.JavaScriptStringEncode (c.ToString (), true);
|
||
Assert.AreEqual (exp, act, "JavaScriptStringEncode " + c.ToString () + " [" + (int) c + "]");
|
||
Assert.AreEqual (expQuoted, actQuoted, "JavaScriptStringEncode (quoted) " + c.ToString () + " [" + (int) c + "]");
|
||
}
|
||
}
|
||
|
||
string JavaScriptStringEncode (string s, bool addDoubleQuotes)
|
||
{
|
||
if (String.IsNullOrEmpty (s))
|
||
return addDoubleQuotes ? "\"\"" : String.Empty;
|
||
|
||
int len = s.Length;
|
||
bool needEncode = false;
|
||
char c;
|
||
for (int i = 0; i < len; i++) {
|
||
c = s [i];
|
||
|
||
if (c >= 0 && c <= 31 || c == 34 || c == 39 || c == 60 || c == 62 || c == 92) {
|
||
needEncode = true;
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (!needEncode)
|
||
return addDoubleQuotes ? "\"" + s + "\"" : s;
|
||
|
||
var sb = new StringBuilder ();
|
||
if (addDoubleQuotes)
|
||
sb.Append ('"');
|
||
|
||
for (int i = 0; i < len; i++) {
|
||
c = s [i];
|
||
if (c >= 0 && c <= 7 || c == 11 || c >= 14 && c <= 31 || c == 39 || c == 60 || c == 62)
|
||
sb.AppendFormat ("\\u{0:x4}", (int) c);
|
||
else switch ((int) c) {
|
||
case 8:
|
||
sb.Append ("\\b");
|
||
break;
|
||
|
||
case 9:
|
||
sb.Append ("\\t");
|
||
break;
|
||
|
||
case 10:
|
||
sb.Append ("\\n");
|
||
break;
|
||
|
||
case 12:
|
||
sb.Append ("\\f");
|
||
break;
|
||
|
||
case 13:
|
||
sb.Append ("\\r");
|
||
break;
|
||
|
||
case 34:
|
||
sb.Append ("\\\"");
|
||
break;
|
||
|
||
case 92:
|
||
sb.Append ("\\\\");
|
||
break;
|
||
|
||
default:
|
||
sb.Append (c);
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (addDoubleQuotes)
|
||
sb.Append ('"');
|
||
|
||
return sb.ToString ();
|
||
}
|
||
[Test]
|
||
public void HtmlEncode_2 ()
|
||
{
|
||
StringWriter sw;
|
||
AssertExtensions.Throws<ArgumentNullException> (() => {
|
||
HttpUtility.HtmlEncode ("string", null);
|
||
}, "#A1");
|
||
|
||
sw = new StringWriter ();
|
||
HttpUtility.HtmlEncode (null, sw);
|
||
Assert.AreEqual (String.Empty, sw.ToString (), "#A2");
|
||
|
||
sw = new StringWriter ();
|
||
HttpUtility.HtmlEncode (String.Empty, sw);
|
||
Assert.AreEqual (String.Empty, sw.ToString (), "#A3");
|
||
|
||
for (int i = 0; i < encoding_pairs.Length; i += 2) {
|
||
sw = new StringWriter ();
|
||
HttpUtility.HtmlEncode (encoding_pairs [i], sw);
|
||
Assert.AreEqual (encoding_pairs [i + 1], sw.ToString (), "#B" + (i / 2).ToString ());
|
||
}
|
||
}
|
||
|
||
[Test]
|
||
public void HtmlEncode_3 ()
|
||
{
|
||
Assert.AreEqual (null, HttpUtility.HtmlEncode (null), "#A1");
|
||
Assert.AreEqual (String.Empty, HttpUtility.HtmlEncode (String.Empty), "#A2");
|
||
|
||
for (int i = 0; i < encoding_pairs.Length; i += 2)
|
||
Assert.AreEqual (encoding_pairs [i + 1], HttpUtility.HtmlEncode (encoding_pairs [i]), "#B" + (i / 2).ToString ());
|
||
}
|
||
[Test]
|
||
public void HtmlEncode_IHtmlString ()
|
||
{
|
||
string origString = "<script>alert ('Hola');</script>";
|
||
var hs = new HtmlString (origString);
|
||
Assert.AreEqual (origString, HttpUtility.HtmlEncode (hs), "#A1");
|
||
}
|
||
[Test]
|
||
[Category ("NotWorking")]
|
||
public void HtmlEncode ()
|
||
{
|
||
for (char c = char.MinValue; c < char.MaxValue; c++) {
|
||
String exp = HtmlEncode (c.ToString ());
|
||
String act = HttpUtility.HtmlEncode (c.ToString ());
|
||
Assert.AreEqual (exp, act, "HtmlEncode " + c.ToString () + " [" + (int) c + "]");
|
||
}
|
||
}
|
||
|
||
string HtmlEncode (string s)
|
||
{
|
||
if (s == null)
|
||
return null;
|
||
|
||
bool needEncode = false;
|
||
for (int i = 0; i < s.Length; i++) {
|
||
char c = s [i];
|
||
if (c == '&' || c == '"' || c == '<' || c == '>' || c > 159
|
||
|| c == '\''
|
||
) {
|
||
needEncode = true;
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (!needEncode)
|
||
return s;
|
||
|
||
StringBuilder output = new StringBuilder ();
|
||
|
||
int len = s.Length;
|
||
for (int i = 0; i < len; i++)
|
||
switch (s [i]) {
|
||
case '&':
|
||
output.Append ("&");
|
||
break;
|
||
case '>':
|
||
output.Append (">");
|
||
break;
|
||
case '<':
|
||
output.Append ("<");
|
||
break;
|
||
case '"':
|
||
output.Append (""");
|
||
break;
|
||
case '\'':
|
||
output.Append ("'");
|
||
break;
|
||
default:
|
||
// MS starts encoding with &# from 160 and stops at 255.
|
||
// We don't do that. One reason is the 65308/65310 unicode
|
||
// characters that look like '<' and '>'.
|
||
if (s [i] > 159 && s [i] < 256) {
|
||
output.Append ("&#");
|
||
output.Append (((int) s [i]).ToString ());
|
||
output.Append (";");
|
||
} else {
|
||
output.Append (s [i]);
|
||
}
|
||
break;
|
||
}
|
||
return output.ToString ();
|
||
}
|
||
|
||
[Test]
|
||
public void UrlDecodeToBytes ()
|
||
{
|
||
byte [] bytes = HttpUtility.UrlDecodeToBytes ("%5c");
|
||
Assert.AreEqual (1, bytes.Length, "#1");
|
||
Assert.AreEqual (0x5c, bytes [0], "#2");
|
||
bytes = HttpUtility.UrlDecodeToBytes ("%5");
|
||
Assert.AreEqual (2, bytes.Length, "#3");
|
||
Assert.AreEqual (0x25, bytes [0], "#4");
|
||
Assert.AreEqual (0x25, bytes [0], "#5");
|
||
}
|
||
|
||
[Test]
|
||
public void UrlDecode1 ()
|
||
{
|
||
Assert.AreEqual ("http://127.0.0.1:8080/appDir/page.aspx?foo=bar",
|
||
HttpUtility.UrlDecode ("http://127.0.0.1:8080/appDir/page.aspx?foo=b%61r"),
|
||
"UrlDecode1 #1");
|
||
|
||
Assert.AreEqual ("http://127.0.0.1:8080/appDir/page.aspx?foo=b%ar",
|
||
HttpUtility.UrlDecode ("http://127.0.0.1:8080/appDir/page.aspx?foo=b%%61r"),
|
||
"UrlDecode1 #2");
|
||
|
||
Assert.AreEqual ("http://127.0.0.1:8080/app%Dir/page.aspx?foo=b%ar",
|
||
HttpUtility.UrlDecode ("http://127.0.0.1:8080/app%Dir/page.aspx?foo=b%%61r"),
|
||
"UrlDecode1 #3");
|
||
|
||
Assert.AreEqual ("http://127.0.0.1:8080/app%%Dir/page.aspx?foo=b%%r",
|
||
HttpUtility.UrlDecode ("http://127.0.0.1:8080/app%%Dir/page.aspx?foo=b%%r"),
|
||
"UrlDecode1 #4");
|
||
|
||
Assert.AreEqual ("http://127.0.0.1:8080/appDir/page.aspx?foo=ba%r",
|
||
HttpUtility.UrlDecode ("http://127.0.0.1:8080/appDir/page.aspx?foo=b%61%r"),
|
||
"UrlDecode1 #5");
|
||
|
||
Assert.AreEqual ("http://127.0.0.1:8080/appDir/page.aspx?foo=bar",
|
||
HttpUtility.UrlDecode ("http://127.0.0.1:8080/appDir/page.aspx?foo=b%u0061r"),
|
||
"UrlDecode1 #6");
|
||
|
||
Assert.AreEqual ("http://127.0.0.1:8080/appDir/page.aspx?foo=b%ar",
|
||
HttpUtility.UrlDecode ("http://127.0.0.1:8080/appDir/page.aspx?foo=b%%u0061r"),
|
||
"UrlDecode1 #7");
|
||
|
||
Assert.AreEqual ("http://127.0.0.1:8080/appDir/page.aspx?foo=b%uu0061r",
|
||
HttpUtility.UrlDecode ("http://127.0.0.1:8080/appDir/page.aspx?foo=b%uu0061r"),
|
||
"UrlDecode1 #8");
|
||
}
|
||
|
||
[Test]
|
||
public void UrlDecode2 ()
|
||
{
|
||
Assert.AreEqual (
|
||
"http://127.0.0.1:8080/appDir/page.aspx?foo=bar",
|
||
HttpUtility.UrlDecode (
|
||
Encoding.UTF8.GetBytes ("http://127.0.0.1:8080/appDir/page.aspx?foo=b%61r"),
|
||
Encoding.UTF8),
|
||
"UrlDecode2 #1");
|
||
|
||
Assert.AreEqual (
|
||
"http://127.0.0.1:8080/appDir/page.aspx?foo=b%ar",
|
||
HttpUtility.UrlDecode (
|
||
Encoding.UTF8.GetBytes ("http://127.0.0.1:8080/appDir/page.aspx?foo=b%%61r"),
|
||
Encoding.UTF8),
|
||
"UrlDecode2 #2");
|
||
|
||
Assert.AreEqual (
|
||
"http://127.0.0.1:8080/app%Dir/page.aspx?foo=b%ar",
|
||
HttpUtility.UrlDecode (
|
||
Encoding.UTF8.GetBytes ("http://127.0.0.1:8080/app%Dir/page.aspx?foo=b%%61r"),
|
||
Encoding.UTF8),
|
||
"UrlDecode2 #3");
|
||
|
||
Assert.AreEqual (
|
||
"http://127.0.0.1:8080/app%%Dir/page.aspx?foo=b%%r",
|
||
HttpUtility.UrlDecode (
|
||
Encoding.UTF8.GetBytes ("http://127.0.0.1:8080/app%%Dir/page.aspx?foo=b%%r"),
|
||
Encoding.UTF8),
|
||
"UrlDecode2 #4");
|
||
|
||
Assert.AreEqual (
|
||
"http://127.0.0.1:8080/appDir/page.aspx?foo=ba%r",
|
||
HttpUtility.UrlDecode (
|
||
Encoding.UTF8.GetBytes ("http://127.0.0.1:8080/appDir/page.aspx?foo=b%61%r"),
|
||
Encoding.UTF8),
|
||
"UrlDecode2 #5");
|
||
|
||
Assert.AreEqual (
|
||
"http://127.0.0.1:8080/appDir/page.aspx?foo=bar",
|
||
HttpUtility.UrlDecode (
|
||
Encoding.UTF8.GetBytes ("http://127.0.0.1:8080/appDir/page.aspx?foo=b%u0061r"),
|
||
Encoding.UTF8),
|
||
"UrlDecode2 #6");
|
||
|
||
Assert.AreEqual (
|
||
"http://127.0.0.1:8080/appDir/page.aspx?foo=b%ar",
|
||
HttpUtility.UrlDecode (
|
||
Encoding.UTF8.GetBytes ("http://127.0.0.1:8080/appDir/page.aspx?foo=b%%u0061r"),
|
||
Encoding.UTF8),
|
||
"UrlDecode2 #7");
|
||
|
||
Assert.AreEqual (
|
||
"http://127.0.0.1:8080/appDir/page.aspx?foo=b%uu0061r",
|
||
HttpUtility.UrlDecode (
|
||
Encoding.UTF8.GetBytes ("http://127.0.0.1:8080/appDir/page.aspx?foo=b%uu0061r"),
|
||
Encoding.UTF8),
|
||
"UrlDecode2 #8");
|
||
}
|
||
|
||
[Test]
|
||
public void UrlDecodeToBytes2 ()
|
||
{
|
||
Assert.AreEqual (
|
||
"http://127.0.0.1:8080/appDir/page.aspx?foo=bar",
|
||
Encoding.UTF8.GetString (
|
||
HttpUtility.UrlDecodeToBytes ("http://127.0.0.1:8080/appDir/page.aspx?foo=b%61r")),
|
||
"UrlDecodeToBytes2 #1");
|
||
|
||
Assert.AreEqual (
|
||
"http://127.0.0.1:8080/appDir/page.aspx?foo=b%ar",
|
||
Encoding.UTF8.GetString (
|
||
HttpUtility.UrlDecodeToBytes ("http://127.0.0.1:8080/appDir/page.aspx?foo=b%%61r")),
|
||
"UrlDecodeToBytes2 #2");
|
||
|
||
Assert.AreEqual (
|
||
"http://127.0.0.1:8080/app%Dir/page.aspx?foo=b%ar",
|
||
Encoding.UTF8.GetString (
|
||
HttpUtility.UrlDecodeToBytes ("http://127.0.0.1:8080/app%Dir/page.aspx?foo=b%%61r")),
|
||
"UrlDecodeToBytes2 #3");
|
||
|
||
Assert.AreEqual (
|
||
"http://127.0.0.1:8080/app%%Dir/page.aspx?foo=b%%r",
|
||
Encoding.UTF8.GetString (
|
||
HttpUtility.UrlDecodeToBytes ("http://127.0.0.1:8080/app%%Dir/page.aspx?foo=b%%r")),
|
||
"UrlDecodeToBytes2 #4");
|
||
|
||
Assert.AreEqual (
|
||
"http://127.0.0.1:8080/appDir/page.aspx?foo=ba%r",
|
||
Encoding.UTF8.GetString (
|
||
HttpUtility.UrlDecodeToBytes ("http://127.0.0.1:8080/appDir/page.aspx?foo=b%61%r")),
|
||
"UrlDecodeToBytes2 #5");
|
||
|
||
Assert.AreEqual (
|
||
"http://127.0.0.1:8080/appDir/page.aspx?foo=b%u0061r",
|
||
Encoding.UTF8.GetString (
|
||
HttpUtility.UrlDecodeToBytes ("http://127.0.0.1:8080/appDir/page.aspx?foo=b%u0061r")),
|
||
"UrlDecodeToBytes2 #6");
|
||
|
||
Assert.AreEqual (
|
||
"http://127.0.0.1:8080/appDir/page.aspx?foo=b%%u0061r",
|
||
Encoding.UTF8.GetString (
|
||
HttpUtility.UrlDecodeToBytes ("http://127.0.0.1:8080/appDir/page.aspx?foo=b%%u0061r")),
|
||
"UrlDecodeToBytes2 #7");
|
||
|
||
Assert.AreEqual (
|
||
"http://127.0.0.1:8080/appDir/page.aspx?foo=b%uu0061r",
|
||
Encoding.UTF8.GetString (
|
||
HttpUtility.UrlDecodeToBytes ("http://127.0.0.1:8080/appDir/page.aspx?foo=b%uu0061r")),
|
||
"UrlDecodeToBytes2 #8");
|
||
}
|
||
|
||
[Test]
|
||
public void EscapedCharacters ()
|
||
{
|
||
for (int i = 0; i < 256; i++) {
|
||
string str = new string ((char) i, 1);
|
||
string encoded = HttpUtility.HtmlEncode (str);
|
||
if ((i > 159 && i < 256) || i == '&' || i == '<' || i == '>' || i == '"'
|
||
|| i == '\''
|
||
) {
|
||
if (encoded [0] != '&' || encoded [encoded.Length - 1] != ';')
|
||
Assert.Fail ("Failed for i = " + i);
|
||
} else if (encoded.Length != 1) {
|
||
Assert.Fail ("Wrong length for i = " + i);
|
||
}
|
||
}
|
||
}
|
||
|
||
[Test (Description = "Bug #507666")]
|
||
public void UrlDecode_Bug507666 ()
|
||
{
|
||
// Get Encoding object.
|
||
var enc_utf8 = Encoding.UTF8;
|
||
var enc_sjis = Encoding.GetEncoding (932);
|
||
|
||
// Generate equiv. client request query string with url-encoded shift_jis string.
|
||
var utf8_string = "紅茶"; // it's UTF-8 string
|
||
var utf8_bin = enc_utf8.GetBytes (utf8_string); // convert to UTF-8 byte[]
|
||
var sjis_bin = Encoding.Convert (enc_utf8, enc_sjis, utf8_bin); // convert to Shift_jis byte[]
|
||
var urlenc_string = HttpUtility.UrlEncode (sjis_bin); // equiv. client request query string.
|
||
|
||
// Test using UrlDecode only.
|
||
var decoded_by_web = HttpUtility.UrlDecode (urlenc_string, enc_sjis);
|
||
|
||
Assert.AreEqual (utf8_string, decoded_by_web, "#A1");
|
||
}
|
||
|
||
[Test]
|
||
public void Decode1 ()
|
||
{
|
||
Assert.AreEqual ("\xE9", HttpUtility.HtmlDecode ("é"));
|
||
}
|
||
|
||
[Test (Description = "Bug #585992")]
|
||
public void Decode2 ()
|
||
{
|
||
string encodedSource = "© == © == © and Γ == Γ == Γ";
|
||
string utf8Result = "© == © == © and Γ == Γ == Γ";
|
||
|
||
Assert.AreEqual (utf8Result, HttpUtility.HtmlDecode (encodedSource), "#A1");
|
||
}
|
||
|
||
[Test]
|
||
public void RoundTrip ()
|
||
{
|
||
string x = "<html>& hello+= world!";
|
||
string y = HttpUtility.HtmlEncode (x);
|
||
string z = HttpUtility.HtmlDecode (y);
|
||
Assert.AreEqual (x, z);
|
||
}
|
||
|
||
[Test]
|
||
public void LooksLikeEntity ()
|
||
{
|
||
string str = "<%# \"hola\" + \"/somepage.aspx?ItemID=\" + DataBinder.Eval(Container.DataItem,\"Country\")" +
|
||
" + \"&mid=\" + ModuleID + \"&pageindex=\" + Request.Params.Get(\"pageindex\") %>";
|
||
Assert.AreEqual (str, HttpUtility.HtmlDecode (str));
|
||
}
|
||
|
||
[Test]
|
||
public void UrlEncodeUnicodeTest ()
|
||
{
|
||
string str = "sch" + (char) 0xf6 + "n";
|
||
|
||
Assert.AreEqual ("sch%u00f6n", HttpUtility.UrlEncodeUnicode (str), "#1");
|
||
Assert.AreEqual ("abc", "abc", "#2");
|
||
Assert.AreEqual ("%26", HttpUtility.UrlEncodeUnicode ("&"), "#3");
|
||
Assert.AreEqual ("%7f", HttpUtility.UrlEncodeUnicode ("" + (char) 127), "#4");
|
||
Assert.AreEqual ("%u0080", HttpUtility.UrlEncodeUnicode ("" + (char) 128), "#5");
|
||
}
|
||
|
||
[Test]
|
||
public void UrlDecodeNoThrow ()
|
||
{
|
||
string str = "../../&param2=%CURRREV%";
|
||
Assert.AreEqual (str, HttpUtility.UrlDecode (str), "#1");
|
||
}
|
||
|
||
static char [] hexChars = "0123456789abcdef".ToCharArray ();
|
||
|
||
const string notEncoded = "!()*-._";
|
||
|
||
static void UrlPathEncodeChar (char c, Stream result)
|
||
{
|
||
if (c < 33 || c > 126) {
|
||
byte [] bIn = Encoding.UTF8.GetBytes (c.ToString ());
|
||
for (int i = 0; i < bIn.Length; i++) {
|
||
result.WriteByte ((byte) '%');
|
||
int idx = ((int) bIn [i]) >> 4;
|
||
result.WriteByte ((byte) hexChars [idx]);
|
||
idx = ((int) bIn [i]) & 0x0F;
|
||
result.WriteByte ((byte) hexChars [idx]);
|
||
}
|
||
} else if (c == ' ') {
|
||
result.WriteByte ((byte) '%');
|
||
result.WriteByte ((byte) '2');
|
||
result.WriteByte ((byte) '0');
|
||
} else
|
||
result.WriteByte ((byte) c);
|
||
}
|
||
|
||
static void UrlEncodeChar (char c, Stream result, bool isUnicode)
|
||
{
|
||
if (c > 255) {
|
||
//FIXME: what happens when there is an internal error?
|
||
//if (!isUnicode)
|
||
// throw new ArgumentOutOfRangeException ("c", c, "c must be less than 256");
|
||
int idx;
|
||
int i = (int) c;
|
||
|
||
result.WriteByte ((byte) '%');
|
||
result.WriteByte ((byte) 'u');
|
||
idx = i >> 12;
|
||
result.WriteByte ((byte) hexChars [idx]);
|
||
idx = (i >> 8) & 0x0F;
|
||
result.WriteByte ((byte) hexChars [idx]);
|
||
idx = (i >> 4) & 0x0F;
|
||
result.WriteByte ((byte) hexChars [idx]);
|
||
idx = i & 0x0F;
|
||
result.WriteByte ((byte) hexChars [idx]);
|
||
return;
|
||
}
|
||
|
||
if (c > ' ' && notEncoded.IndexOf (c) != -1) {
|
||
result.WriteByte ((byte) c);
|
||
return;
|
||
}
|
||
if (c == ' ') {
|
||
result.WriteByte ((byte) '+');
|
||
return;
|
||
}
|
||
if ((c < '0') ||
|
||
(c < 'A' && c > '9') ||
|
||
(c > 'Z' && c < 'a') ||
|
||
(c > 'z')) {
|
||
if (isUnicode && c > 127) {
|
||
result.WriteByte ((byte) '%');
|
||
result.WriteByte ((byte) 'u');
|
||
result.WriteByte ((byte) '0');
|
||
result.WriteByte ((byte) '0');
|
||
} else
|
||
result.WriteByte ((byte) '%');
|
||
|
||
int idx = ((int) c) >> 4;
|
||
result.WriteByte ((byte) hexChars [idx]);
|
||
idx = ((int) c) & 0x0F;
|
||
result.WriteByte ((byte) hexChars [idx]);
|
||
} else
|
||
result.WriteByte ((byte) c);
|
||
}
|
||
|
||
[Test]
|
||
public void UrlEncode ()
|
||
{
|
||
for (char c = char.MinValue; c < char.MaxValue; c++) {
|
||
byte [] bIn;
|
||
bIn = Encoding.UTF8.GetBytes (c.ToString ());
|
||
MemoryStream expected = new MemoryStream ();
|
||
MemoryStream expUnicode = new MemoryStream ();
|
||
|
||
//build expected result for UrlEncode
|
||
for (int i = 0; i < bIn.Length; i++)
|
||
UrlEncodeChar ((char) bIn [i], expected, false);
|
||
//build expected result for UrlEncodeUnicode
|
||
UrlEncodeChar (c, expUnicode, true);
|
||
|
||
Assert.AreEqual (Encoding.ASCII.GetString (expected.ToArray ()), HttpUtility.UrlEncode (c.ToString ()),
|
||
"UrlEncode " + c.ToString ());
|
||
Assert.AreEqual (Encoding.ASCII.GetString (expUnicode.ToArray ()), HttpUtility.UrlEncodeUnicode (c.ToString ()),
|
||
"UrlEncodeUnicode " + c.ToString ());
|
||
}
|
||
}
|
||
|
||
[Test]
|
||
public void UrlPathEncode ()
|
||
{
|
||
Assert.AreEqual (null, HttpUtility.UrlPathEncode (null), "#A1-1");
|
||
Assert.AreEqual (String.Empty, HttpUtility.UrlPathEncode (String.Empty), "#A1-2");
|
||
|
||
for (char c = char.MinValue; c < char.MaxValue; c++) {
|
||
MemoryStream expected = new MemoryStream ();
|
||
UrlPathEncodeChar (c, expected);
|
||
|
||
String exp = Encoding.ASCII.GetString (expected.ToArray ());
|
||
String act = HttpUtility.UrlPathEncode (c.ToString ());
|
||
Assert.AreEqual (exp, act, "UrlPathEncode " + c.ToString ());
|
||
}
|
||
}
|
||
[Test]
|
||
public void UrlPathEncode2 ()
|
||
{
|
||
string s = "default.xxx?sdsd=sds";
|
||
string s2 = HttpUtility.UrlPathEncode (s);
|
||
Assert.AreEqual (s, s2, "UrlPathEncode " + s);
|
||
}
|
||
|
||
|
||
[Test]
|
||
public void ParseQueryString ()
|
||
{
|
||
ParseQueryString_Helper (HttpUtility.ParseQueryString ("name=value"), "#1",
|
||
new string [] { "name" }, new string [] [] { new string [] { "value" } });
|
||
|
||
ParseQueryString_Helper (HttpUtility.ParseQueryString ("name=value&foo=bar"), "#2",
|
||
new string [] { "name", "foo" }, new string [] [] { new string [] { "value" }, new string [] { "bar" } });
|
||
|
||
ParseQueryString_Helper (HttpUtility.ParseQueryString ("name=value&name=bar"), "#3",
|
||
new string [] { "name" }, new string [] [] { new string [] { "value", "bar" } });
|
||
|
||
ParseQueryString_Helper (HttpUtility.ParseQueryString ("value"), "#4",
|
||
new string [] { null }, new string [] [] { new string [] { "value" } });
|
||
|
||
ParseQueryString_Helper (HttpUtility.ParseQueryString ("name=value&bar"), "#5",
|
||
new string [] { "name", null }, new string [] [] { new string [] { "value" }, new string [] { "bar" } });
|
||
|
||
ParseQueryString_Helper (HttpUtility.ParseQueryString ("bar&name=value"), "#6",
|
||
new string [] { null, "name" }, new string [] [] { new string [] { "bar" }, new string [] { "value" } });
|
||
|
||
ParseQueryString_Helper (HttpUtility.ParseQueryString ("value&bar"), "#7",
|
||
new string [] { null }, new string [] [] { new string [] { "value", "bar" } });
|
||
|
||
ParseQueryString_Helper (HttpUtility.ParseQueryString (""), "#8",
|
||
new string [0], new string [0] []);
|
||
|
||
ParseQueryString_Helper (HttpUtility.ParseQueryString ("="), "#9",
|
||
new string [] { "" }, new string [] [] { new string [] { "" } });
|
||
|
||
ParseQueryString_Helper (HttpUtility.ParseQueryString ("&"), "#10",
|
||
new string [] { null }, new string [] [] { new string [] { "", "" } });
|
||
|
||
ParseQueryString_Helper (HttpUtility.ParseQueryString ("?value"), "#11",
|
||
new string [] { null }, new string [] [] { new string [] { "value" } });
|
||
|
||
try {
|
||
HttpUtility.ParseQueryString (null);
|
||
} catch (Exception e) {
|
||
Assert.AreEqual (typeof (ArgumentNullException), e.GetType (), "#12");
|
||
}
|
||
|
||
try {
|
||
HttpUtility.ParseQueryString ("", null);
|
||
} catch (Exception e) {
|
||
Assert.AreEqual (typeof (ArgumentNullException), e.GetType (), "#13");
|
||
}
|
||
|
||
string str = new string (new char [] { '\u304a', '\u75b2', '\u308c', '\u69d8', '\u3067', '\u3059' });
|
||
string utf8url = HttpUtility.UrlEncode (str, Encoding.UTF8);
|
||
ParseQueryString_Helper (HttpUtility.ParseQueryString (utf8url + "=" + utf8url), "#14",
|
||
new string [] { str }, new string [] [] { new string [] { str } });
|
||
|
||
ParseQueryString_Helper (HttpUtility.ParseQueryString ("name=value=test"), "#15",
|
||
new string [] { "name" }, new string [] [] { new string [] { "value=test" } });
|
||
}
|
||
static void ParseQueryString_Helper (NameValueCollection nvc, string msg, string [] keys, string [] [] values)
|
||
{
|
||
Assert.AreEqual (keys.Length, nvc.Count, msg + "[Count]");
|
||
for (int i = 0; i < keys.Length; i++) {
|
||
Assert.AreEqual (keys [i], nvc.GetKey (i), msg + "[Key]");
|
||
string [] tmp = nvc.GetValues (i);
|
||
Assert.AreEqual (values [i].Length, tmp.Length, msg + "[ValueCount]");
|
||
for (int q = 0; q < values [i].Length; q++)
|
||
Assert.AreEqual (values [i] [q], tmp [q], msg + "[Value]");
|
||
}
|
||
}
|
||
|
||
string [] decoding_pairs = {
|
||
@"áÁâ´æÆàÀℵαΑ&∧∠åÅ≈ãÃäÄ„βΒ¦•∩çǸ¢χΧˆ♣≅©↵∪¤†‡↓⇓°δΔ♦÷éÉêÊèÈ∅  εΕ≡ηΗðÐëË€∃ƒ∀½¼¾⁄γΓ≥>↔⇔♥…íÍîΡìÌℑ∞∫ιΙ¿∈ïÏκΚλΛ⟨«←⇐⌈“≤⌊∗◊‎‹‘<¯—µ·−μΜ∇ –≠∋¬∉⊄ñÑνΝóÓôÔœŒòÒ‾ωΩοΟ⊕∨ªºøØõÕ⊗öÖ¶∂‰⊥φΦπΠϖ±£′″∏∝ψΨ"√⟩»→⇒⌉”ℜ®⌋ρΡ‏›’‚šŠ⋅§­σΣς∼♠⊂⊆∑⊃¹²³⊇ßτΤ∴θΘϑ þޘיúÚ↑⇑ûÛùÙ¨ϒυΥüÜ℘ξΞýÝ¥ÿŸζΖ‍‌",
|
||
@"áÁâ´æÆàÀℵαΑ&∧∠åÅ≈ãÃäÄ„βΒ¦•∩çǸ¢χΧˆ♣≅©↵∪¤†‡↓⇓°δΔ♦÷éÉêÊèÈ∅ εΕ≡ηΗðÐëË€∃ƒ∀½¼¾⁄γΓ≥>↔⇔♥…íÍîΡìÌℑ∞∫ιΙ¿∈ïÏκΚλΛ〈«←⇐⌈“≤⌊∗◊‹‘<¯—µ·−μΜ∇ –≠∋¬∉⊄ñÑνΝóÓôÔœŒòÒ‾ωΩοΟ⊕∨ªºøØõÕ⊗öÖ¶∂‰⊥φΦπΠϖ±£′″∏∝ψΨ""√〉»→⇒⌉”ℜ®⌋ρΡ›’‚šŠ⋅§σΣς∼♠⊂⊆∑⊃¹²³⊇ßτΤ∴θΘϑ þޘיúÚ↑⇑ûÛùÙ¨ϒυΥüÜ℘ξΞýÝ¥ÿŸζΖ",
|
||
@"á?dCO+6Mk'2RÁT148quH^^=972 â#Âjs""{1LZz)U´u@Rv-05n Læ3x}Æ!à,=*-J*À=P|BℵY<g?cg>jB)αΑ9#4V`)|&J/n&JVK56X\2q*F∧Js∠6k6å""Å?rGt≈\F <9IM{s-ã(ShKÃw/[%,ksf93'kä+b$@Q{5ÄUo„aN~'ycb>VKGcjoβoR8""%B`LΒI7g""k5]A>^B¦lllUPg5#b•8Pw,bwSiY ""5]a∩_R@m&D+Lz""dKLTçKH&I}6)_QÇmS%BZV/*Xo¸s5[¢-$|)|L&5~χY/3cdUrnΧ8ˆ&)@KU@scEW2I♣p2,US7f>&m!F≅Fr9A%,Ci'y[]F+©PY↵FeCrQI<:pPP~;>∪¤y J#R&%%i†Ow,‡T↓KpY`WSAo$i:r⇓']=°k12&UI@_δ(9xDΔdz♦RJdB""F^Y}g÷2kbZ2>@yBfué9!9J(vÉ\TwTS2X5iêSLWaTMQE]e&ÊjW{\#JAh{Ua=è5È6/GY∅U n: dcSfεΕ1Yoi?X≡.-s!n|i9U?3:6η+|6Ηha?>fm!v,ðc;Ky]88Ð4T@qO#.ë@Kl3%ËX-VvUoE& €o9T:r8\||^ha;∃1;/BMT*xJ(a>BƒbH'-TH!6NrP∀n½5Fqvq_e9_""XJ¼vmLXTtu:TVZ,¾syl;qEe:b$5j⁄b Hg%Tγ[ΓH≥>{1wT↔o6i~jjKC02⇔Q4i6m(2tpl♥iQj!…4le""4} Lv5{CsíD*u]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<:u^Vj}\?7SIauBh›u[ !rto/[UHog’xe6gY<24BY.‚`ZNR}šuY{Gg;FŠ⋅az4TlWKYbJ.h§c`9FrP5_)σwx.nP}z@ΣNP9-$@j5ς∼'ogIt:.@Gul♠""p\\rH[)⊂Om/|3G+BQe⊆5s!f/O9SA\RJkv∑GOFMAXu⊃W¹²L`r""}u/n³.ouLC⊇(fß{τB%e [Τ$DD>kIdV#X`?^\∴|S?Wθx)2P.![^5ΘzqF""pjϑ#BE1u? GGG>(EQEþ!""y1r/Þm&@[\mw[kNR˜|1G#i[(×X<UotTID uY™sWW+TbxYúkQXr!H6Ú~0TiH1POP↑(CRZttz\EY<⇑&bN7ki|ûr,3j!e$kJE&Z$zÛ5{0[bvD""[<P)ù;1EeRSrz/gY/Ù/1 S`I*q8:Z-¨%N)WϒO[2P9 ?υOΥtüÜVLq℘2""(Z'~~""uiXξNCqΞ9)S]^v 3ýx""|2&$`GÝ<&Nr¥[3NB5fÿ c""MzMw3(;""sŸζ{!Ζoevp1'j(E`vJSigw>yc*U",
|
||
@"áÁâ´æÆàÀ&alefsym&alpha&Alpha&&and&angåÅ&asympãÃäÄ&bdquo&beta&Beta¦&bull&capçǸ¢&chi&Chi&circ&clubs&cong©&crarr&cup¤&dagger&Dagger&darr&dArr°&delta&Delta&diams÷éÉêÊèÈ&empty&emsp&ensp&epsilon&Epsilon&equiv&eta&EtaðÐëË&euro&exist&fnof&forall½¼¾&frasl&gamma&Gamma&ge>&harr&hArr&hearts&hellipíÍîΡìÌ&image&infin&int&iota&Iota¿&isinïÏ&kappa&Kappa&lambda&Lambda&lang«&larr&lArr&lceil&ldquo&le&lfloor&lowast&loz&lrm&lsaquo&lsquo<¯&mdashµ·&minus&mu&Mu&nabla &ndash&ne&ni¬¬in&nsubñÑ&nu&NuóÓôÔ&oelig&OEligòÒ&oline&omega&Omega&omicron&Omicron&oplus&orªºøØõÕ&otimesöÖ¶&part&permil&perp&phi&Phi&pi&Pi&piv±£&prime&Prime&prod&prop&psi&Psi"&radic&rang»&rarr&rArr&rceil&rdquo&real®&rfloor&rho&Rho&rlm&rsaquo&rsquo&sbquo&scaron&Scaron&sdot§­&sigma&Sigma&sigmaf&sim&spades&sub&sube&sum&sup¹²³&supeß&tau&Tau&there4&theta&Theta&thetasym&thinspþÞ&tilde×&tradeúÚ&uarr&uArrûÛùÙ¨&upsih&upsilon&UpsilonüÜ&weierp&xi&XiýÝ¥ÿ&Yuml&zeta&Zeta&zwj&zwnj",
|
||
@"áÁâ´æÆàÀ&alefsym&alpha&Alpha&&and&angåÅ&asympãÃäÄ&bdquo&beta&Beta¦&bull&capçǸ¢&chi&Chi&circ&clubs&cong©&crarr&cup¤&dagger&Dagger&darr&dArr°&delta&Delta&diams÷éÉêÊèÈ&empty&emsp&ensp&epsilon&Epsilon&equiv&eta&EtaðÐëË&euro&exist&fnof&forall½¼¾&frasl&gamma&Gamma&ge>&harr&hArr&hearts&hellipíÍîΡìÌ&image&infin&int&iota&Iota¿&isinïÏ&kappa&Kappa&lambda&Lambda&lang«&larr&lArr&lceil&ldquo&le&lfloor&lowast&loz&lrm&lsaquo&lsquo<¯&mdashµ·&minus&mu&Mu&nabla &ndash&ne&ni¬¬in&nsubñÑ&nu&NuóÓôÔ&oelig&OEligòÒ&oline&omega&Omega&omicron&Omicron&oplus&orªºøØõÕ&otimesöÖ¶&part&permil&perp&phi&Phi&pi&Pi&piv±£&prime&Prime&prod&prop&psi&Psi"&radic&rang»&rarr&rArr&rceil&rdquo&real®&rfloor&rho&Rho&rlm&rsaquo&rsquo&sbquo&scaron&Scaron&sdot§­&sigma&Sigma&sigmaf&sim&spades&sub&sube&sum&sup¹²³&supeß&tau&Tau&there4&theta&Theta&thetasym&thinspþÞ&tilde×&tradeúÚ&uarr&uArrûÛùÙ¨&upsih&upsilon&UpsilonüÜ&weierp&xi&XiýÝ¥ÿ&Yuml&zeta&Zeta&zwj&zwnj",
|
||
@" ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ",
|
||
@" ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ",
|
||
@"�	

 ",
|
||
"�\x1\x2\x3\x4\x5\x6\x7\x8\x9\xa\xb\xc\xd\xe\xf\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f ",
|
||
@"�	

 ",
|
||
"�\x1\x2\x3\x4\x5\x6\x7\x8\x9\xa\xb\xc\xd\xe\xf\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f ",
|
||
@" ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ",
|
||
" ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ",
|
||
};
|
||
string [] encoding_pairs = {
|
||
@"áÁâ´æÆàÀℵαΑ&∧∠åÅ≈ãÃäÄ„βΒ¦•∩çǸ¢χΧˆ♣≅©↵∪¤†‡↓⇓°δΔ♦÷éÉêÊèÈ∅ εΕ≡ηΗðÐëË€∃ƒ∀½¼¾⁄γΓ≥>↔⇔♥…íÍîΡìÌℑ∞∫ιΙ¿∈ïÏκΚλΛ〈«←⇐⌈“≤⌊∗◊‹‘<¯—µ·−μΜ∇ –≠∋¬∉⊄ñÑνΝóÓôÔœŒòÒ‾ωΩοΟ⊕∨ªºøØõÕ⊗öÖ¶∂‰⊥φΦπΠϖ±£′″∏∝ψΨ""√〉»→⇒⌉”ℜ®⌋ρΡ›’‚šŠ⋅§σΣς∼♠⊂⊆∑⊃¹²³⊇ßτΤ∴θΘϑ þޘיúÚ↑⇑ûÛùÙ¨ϒυΥüÜ℘ξΞýÝ¥ÿŸζΖ",
|
||
@"áÁâ´æÆàÀℵαΑ&∧∠åÅ≈ãÃäÄ„βΒ¦•∩çǸ¢χΧˆ♣≅©↵∪¤†‡↓⇓°δΔ♦÷éÉêÊèÈ∅ εΕ≡ηΗðÐëË€∃ƒ∀½¼¾⁄γΓ≥>↔⇔♥…íÍîΡìÌℑ∞∫ιΙ¿∈ïÏκΚλΛ〈«←⇐⌈“≤⌊∗◊‹‘<¯—µ·−μΜ∇ –≠∋¬∉⊄ñÑνΝóÓôÔœŒòÒ‾ωΩοΟ⊕∨ªºøØõÕ⊗öÖ¶∂‰⊥φΦπΠϖ±£′″∏∝ψΨ"√〉»→⇒⌉”ℜ®⌋ρΡ›’‚šŠ⋅§­σΣς∼♠⊂⊆∑⊃¹²³⊇ßτΤ∴θΘϑ þޘיúÚ↑⇑ûÛùÙ¨ϒυΥüÜ℘ξΞýÝ¥ÿŸζΖ",
|
||
@"á9cP!qdO#hU@mg1ÁK%0<}*âÂ5[Y;lfMQ$4`´uim7E`%_1zVDkæ[cM{Æt9y:E8Hb;;$;Y'àUa6wÀ<$@W9$4NL*h#'ℵk\zαG}{}hC-Α|=QhyLT%`&wB!@#x51R 4C∧]Z3n∠y>:{JZ'v|c0;N""åzcWM'z""gÅo-JX!r.e≈Z+BT{wF8+ãQ 6P1o?x""ef}vUÃ+</Nt)TI]sä0Eg_'mn&6WY[8Äay+ u[3kqoZ„i6rβUX\:_y1A^x.p>+Β`uf3/HI¦7bCRv%o$X3:•∩ç|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o8,lh\ÜN`'g℘(sJ8h3P]cF ξcdQ_OC]U#ΞBby=Sý9tI_Ý}p(D51=X¥cH8L)$*]~=IÿdbŸf>J^1Dnζ@(drH;91?{6`xJΖ4N4[u+59.W\v]GGtKvCC0`A",
|
||
@"áÁâ´æÆàÀ&alefsym&alpha&Alpha&&and&angåÅ&asympãÃäÄ&bdquo&beta&Beta¦&bull&capçǸ¢&chi&Chi&circ&clubs&cong©&crarr&cup¤&dagger&Dagger&darr&dArr°&delta&Delta&diams÷éÉêÊèÈ&empty&emsp&ensp&epsilon&Epsilon&equiv&eta&EtaðÐëË&euro&exist&fnof&forall½¼¾&frasl&gamma&Gamma&ge>&harr&hArr&hearts&hellipíÍîΡìÌ&image&infin&int&iota&Iota¿&isinïÏ&kappa&Kappa&lambda&Lambda&lang«&larr&lArr&lceil&ldquo&le&lfloor&lowast&loz&lrm&lsaquo&lsquo<¯&mdashµ·&minus&mu&Mu&nabla &ndash&ne&ni¬¬in&nsubñÑ&nu&NuóÓôÔ&oelig&OEligòÒ&oline&omega&Omega&omicron&Omicron&oplus&orªºøØõÕ&otimesöÖ¶&part&permil&perp&phi&Phi&pi&Pi&piv±£&prime&Prime&prod&prop&psi&Psi"&radic&rang»&rarr&rArr&rceil&rdquo&real®&rfloor&rho&Rho&rlm&rsaquo&rsquo&sbquo&scaron&Scaron&sdot§­&sigma&Sigma&sigmaf&sim&spades&sub&sube&sum&sup¹²³&supeß&tau&Tau&there4&theta&Theta&thetasym&thinspþÞ&tilde×&tradeúÚ&uarr&uArrûÛùÙ¨&upsih&upsilon&UpsilonüÜ&weierp&xi&XiýÝ¥ÿ&Yuml&zeta&Zeta&zwj&zwnj",
|
||
@"&aacute&Aacute&acirc&Acirc&acute&aelig&AElig&agrave&Agrave&alefsym&alpha&Alpha&amp&and&ang&aring&Aring&asymp&atilde&Atilde&auml&Auml&bdquo&beta&Beta&brvbar&bull&cap&ccedil&Ccedil&cedil&cent&chi&Chi&circ&clubs&cong&copy&crarr&cup&curren&dagger&Dagger&darr&dArr&deg&delta&Delta&diams&divide&eacute&Eacute&ecirc&Ecirc&egrave&Egrave&empty&emsp&ensp&epsilon&Epsilon&equiv&eta&Eta&eth&ETH&euml&Euml&euro&exist&fnof&forall&frac12&frac14&frac34&frasl&gamma&Gamma&ge&gt&harr&hArr&hearts&hellip&iacute&Iacute&icirc&Icirc&iexcl&igrave&Igrave&image&infin&int&iota&Iota&iquest&isin&iuml&Iuml&kappa&Kappa&lambda&Lambda&lang&laquo&larr&lArr&lceil&ldquo&le&lfloor&lowast&loz&lrm&lsaquo&lsquo&lt&macr&mdash&micro&middot&minus&mu&Mu&nabla&nbsp&ndash&ne&ni&not&notin&nsub&ntilde&Ntilde&nu&Nu&oacute&Oacute&ocirc&Ocirc&oelig&OElig&ograve&Ograve&oline&omega&Omega&omicron&Omicron&oplus&or&ordf&ordm&oslash&Oslash&otilde&Otilde&otimes&ouml&Ouml&para&part&permil&perp&phi&Phi&pi&Pi&piv&plusmn&pound&prime&Prime&prod&prop&psi&Psi&quot&radic&rang&raquo&rarr&rArr&rceil&rdquo&real&reg&rfloor&rho&Rho&rlm&rsaquo&rsquo&sbquo&scaron&Scaron&sdot&sect&shy&sigma&Sigma&sigmaf&sim&spades&sub&sube&sum&sup&sup1&sup2&sup3&supe&szlig&tau&Tau&there4&theta&Theta&thetasym&thinsp&thorn&THORN&tilde&times&trade&uacute&Uacute&uarr&uArr&ucirc&Ucirc&ugrave&Ugrave&uml&upsih&upsilon&Upsilon&uuml&Uuml&weierp&xi&Xi&yacute&Yacute&yen&yuml&Yuml&zeta&Zeta&zwj&zwnj",
|
||
@" ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ",
|
||
@" ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ",
|
||
"�\x1\x2\x3\x4\x5\x6\x7\x8\x9\xa\xb\xc\xd\xe\xf\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f ",
|
||
"&#000;\x1\x2\x3\x4\x5\x6\x7\x8\x9\xa\xb\xc\xd\xe\xf\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f ",
|
||
"�\x1\x2\x3\x4\x5\x6\x7\x8\x9\xa\xb\xc\xd\xe\xf\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f ",
|
||
"&#x00;\x1\x2\x3\x4\x5\x6\x7\x8\x9\xa\xb\xc\xd\xe\xf\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f ",
|
||
@" ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ",
|
||
@" ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ",
|
||
};
|
||
|
||
[Test]
|
||
public void ToStringEncoding ()
|
||
{
|
||
var queryStringNameValues = HttpUtility.ParseQueryString(string.Empty);
|
||
queryStringNameValues.Add("ReturnUrl", @"http://localhost/login/authenticate?ReturnUrl=http://localhost/secured_area&__provider__=google");
|
||
|
||
var expected = "ReturnUrl=http%3a%2f%2flocalhost%2flogin%2fauthenticate%3fReturnUrl%3dhttp%3a%2f%2flocalhost%2fsecured_area%26__provider__%3dgoogle";
|
||
Assert.AreEqual (expected, queryStringNameValues.ToString());
|
||
}
|
||
}
|
||
}
|
||
|