How to decode ASCII in a string to character without changing the string

Hi There,

I am working on a project where I need to select the file name from a URL and put it into a data table column before updating it back into spreadsheet. The issue is the filename from the URL has certain ASCII characters like %20%26 in between the file name. I want to change these ascii characters to normal characters without disturbing the file name.

For e.g
String from URL : ABC%20%26PQR%20XYZ.pdf
Intented output : ABC &PQR_XYZ.pdf

I have tried using System.Web.HttpUtility.htmldecode(string) but this isn’t working for me.

it should work if it was really from a url… oh, now i see you got the wrong function there… go with @Yoichi that it will work.

Hi,

Can you try the following?

System.Web.HttpUtility.UrlDecode(string) 

Regards,

3 Likes

str=System.Uri.UnescapeDataString(“ABC%20%26PQR%20XYZ.pdf”)

image

Why post another solution if the above already works?

is it any problem to give solution?

Yes, if our friend already gave one that works and you are just “hunting” for solution markers… Not very polite thing to do.

i agree i will respect you now on words you can tel to every one in forum once any one gave solution others wont give solution.It is not right way

1 Like

Thank you @Yoichi…This worked for me

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.