Pekinese
Pekinese

Reputation: 177

c# decode HTML chars in email

An array contains an email. This e-mail looks at the moment like:

testmail%40mail.de

I'm searching for an methode to get this e-mail to readable format for humans. I know everybody would be able to identify '%40' after some time, but I would need to get for example in this case '[email protected]' I found the solution to use "System.Net.WebUtility.HtmlDecode()". I use .Net4.0 but there was no readable output using the methode above (output was the same one). I hope to get an easy way to solve this.

Upvotes: 0

Views: 223

Answers (1)

Christopher Cartlidge
Christopher Cartlidge

Reputation: 186

The email address is URL encoded therefore you are required to URL decode it.

.NET has the following utilities available for you to do this:

HttpServerUtility.UrlDecode(string) or HttpUtility.UrlDecode(string)

Upvotes: 2

Related Questions