We help IT Professionals succeed at work.

replace %20 with space

brokeMyLegBiking
on
Medium Priority
406 Views
Last Modified: 2012-06-27
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.
Comment
Watch Question

Commented:
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).

Commented:
Is this what you want?

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

Roger
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2008
Commented:
System.Web.HttpUtility.HtmlDecode(s)

Bob

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2008

Commented:
System.Web.HttpUtility.UrlDecode(s)

Bob

Author

Commented:
brilliant bob, thanks.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.