C# WebClient DownloadData issue on double quotes
Im making a request to a url, but in the returned string i get foreach " an \"
This is my code:
WebClient webclient = new WebClient();
byte[] databuffer = webclient.DownloadData(url);
return Encoding.UTF8.GetString(databuffer);
What could be the problem to return as content of the webpage for instance:
<div id=\"whatever\">开发者_如何学Go
instead <div id="whatever">
?
There's no problem, you are probably looking the result in Visual Studio Debugger which does this. The actual string you are getting doesn't have any \"
. Try saving it to a file and you will see:
File.WriteAllBytes(@"c:\test.htm", databuffer);
So no worries, unless the web page you are downloading is crap and is using \"
instead of "
in the response.
精彩评论