spaces, pipelins etc. in a url string

  • Thread starter Thread starter Moshe Foobar
  • Start date Start date
M

Moshe Foobar

Hi,
When i save a url into a string :
string myURL = @"http://www.allmusic.com/cg/amg.dll?p=amg&sql=2surfer|rosa";

but when i d/l this page :

WebClient myClient = new WebClient();
StreamReader sr = new
StreamReader(myClient.OpenRead_searchAlbum),System.Text.Encoding.Unicode);
string result = sr.ReadToEnd();
string result = sr.ReadToEnd();

its seems that the pipeline "|" turnd into %c7 and the spaces turned
to %20

how can I fix that ?
 
Hi,

Does this give you error?
It's the expected result, the query string is encoded according to the http
protocol. It should not give you error, though.

Hope this help,
 
The %c7 is the url-encoded version for the |
To convert it back have a look at .... urldecode

System.Web.HttpUtility.UrlDecode

Hope this helps,
Edwin Kusters
 
urldecode takes a string that has %20 and %c7 and transform them to
spaces and | but this is not my case.
The thing is that for some reason the string i send to the
StreamReader changes in some sort of way to a string with %20 and %c7.

in my code result is the url's html code.
if u look at the html code of :
http://www.allmusic.com/cg/amg.dll?p=amg&sql=2Surfer|Rosa
u will see the code im lookinf for
but i get the code of this :
http://www.allmusic.com/cg/amg.dll?p=amg&sql=2Surfer&c7Rosa
you can see the string im sending as a url and it contains | but
somewhere along the way the WebClient gets it with %c7 and not |
 
Back
Top