Link to home
Create AccountLog in
Avatar of brokeMyLegBiking
brokeMyLegBiking

asked on

replace %20 with space

what is the best way to replace all the encoded symbos in a URI to non-encoded.

For example,    %20   is a space.

Should I create a URI object and does it have a property "non-encoded" or something like that. currently I am just using the satement:

sFile = sFile.Replace("%20", " ")

but I would like something better.
Avatar of JRossi1
JRossi1

I think your method is a good way to format the URI.  You can store these symbols in a resource file or table and add some logic to search for the symbol and replace with the correct "non-encoded" version.  

Check out the following link:  http://msdn2.microsoft.com/en-US/library/system.uri(VS.80).aspx

There is a great deal of information regarding the URI Class, it's properties and methods.  There may be a "non-encoded" property/method there, but not by that name (I Looked).

Is this what you want?

        Dim myUri As New Uri("http://www.contoso.com/Hello%20World.htm", True)
        Debug.WriteLine(myUri.ToString)

Roger
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
System.Web.HttpUtility.UrlDecode(s)

Bob
Avatar of brokeMyLegBiking

ASKER

brilliant bob, thanks.