Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

.NET 4.5 new Uri unescaping double dot when there's inverted question mark

$
0
0
I have the next problem. I'm trying to post the an status to twitter that contains an inverted question mark and a link. For instance, "¿http.www.google.com". 

I'm using twitterizer for posting to twitter but when I try to post it, twitter response is "Could not authenticate you". Debugging twitterizer I have discovered that the problem is that when the Uri for making the request to Twitter is being built with the next string:

    string correctUri = "http://api.twitter.com/1.1/statuses/update.json?status=%C2%BFhttp%3A%2F%2Fwww.google.com";

That's correct, every special character is escaped and everything is fine. But when new Uri is done with that string, then it comes the problem:

    Uri uri =new Uri(correctUri);

Because the AbsoluteUri value is http://api.twitter.com/1.1/statuses/update.json?status=%C2%BFhttp:%2F%2Fwww.google.es . As you can see, it shows "http:" and that's exactly the problem.

I have tried the same exact code under .NET 4.5 and .NET 4 and it's only a problem under .NET 4.5. I also tried to post the same text under the two versions of .NET and it only works under .NET 4 and the only difference at the http request made to twitter (captured with fiddler) is the double dot. 

I have discovered also that the problem only happens when you put an inverted question mark (%C2%BF in UTF-8) at the status. But when you don't put it, there's no problem at all.

Is there any solution to this problem? I have tried so many things, but nothing works.

Viewing all articles
Browse latest Browse all 8156


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>