Skip to content

Commit

Permalink
changing Uri query encoding to use capital HEX
Browse files Browse the repository at this point in the history
  • Loading branch information
sdether committed May 26, 2011
1 parent bca7035 commit a9ee331
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 1 addition & 4 deletions src/mindtouch.dream/system/stringutil.cs
Expand Up @@ -981,10 +981,7 @@ public static class StringUtil {
/// <param name="n">Integer to convert.</param>
/// <returns>Hexadecimal character.</returns>
public static char IntToHexChar(int n) {
if(n <= 9) {
return (char)(n + 0x30);
}
return (char)((n - 10) + 0x61);
return n.ToString("X")[0];
}

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions src/tests/DreamMisc/XUri-Test.cs
Expand Up @@ -300,7 +300,7 @@ public class XUriTest {
Assert.AreEqual("/c=GB", uri.Path);
Assert.AreEqual(1, uri.Segments.Length);
Assert.AreEqual(false, uri.TrailingSlash);
Assert.AreEqual("objectClass%3fone", uri.Query);
Assert.AreEqual("objectClass%3Fone", uri.Query);
Assert.AreEqual(null, uri.Fragment);
}

Expand Down Expand Up @@ -490,7 +490,7 @@ public class XUriTest {

[Test]
public void Square_brackets_in_parsed_query_are_encoded_on_render() {
Assert.AreEqual("http://host/foo?bar%5b123%5d=abc",new XUri("http://host/foo?bar[123]=abc").ToString());
Assert.AreEqual("http://host/foo?bar%5B123%5D=abc",new XUri("http://host/foo?bar[123]=abc").ToString());
}

[Test]
Expand Down

0 comments on commit a9ee331

Please sign in to comment.