I am struggling with the Uri class in .net, when parsing IRIs.
Consider this IRI:
var iriStr = "http://example.com/base/植物/名=しそ;使用部=葉";
When I create and Uri from this (regardless of the iri parsing setting) I get the following:
var uri = new Uri(iriStr);
Assert.AreEqual(iriStr, uri.ToString()); // this works
Assert.AreEqual(iriStr, uri.AbsoluteUri); // this fails
The actual value uri.AbsolutUri returns is:
http://example.com/base/%E6%A4%8D%E7%89%A9%2F%E5%90%8D%3D%E3%81%97%E3%81%9D%3B%E4%BD%BF%E7%94%A8%E9%83%A8%3D%E8%91%89
It seems that the Uri class works as described in the RFC3986 and not RFC3987 specification (although msdn says something else). I need the Uri#AbsoluteUri to return a correct string prepresentation escaped according to the latter.
Why is this that way? Any way to change this behavior?