Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebUtility.HtmlDecode replacement in .NET Core

I need to decode HTML characters in .NET Core (MVC6). It looks like .NET Core doesn't have WebUtility.HtmlDecode function which everybody used for that purpose before. Is there a replacement exist in .NET Core?

like image 707
sibvic Avatar asked Feb 16 '16 16:02

sibvic


1 Answers

This is in the System.Net.WebUtility class (Since .NET Standard 1.0) :

// // Summary: //     Provides methods for encoding and decoding URLs when processing Web requests. public static class WebUtility {     public static string HtmlDecode(string value);     public static string HtmlEncode(string value);     public static string UrlDecode(string encodedValue);     public static byte[] UrlDecodeToBytes(byte[] encodedValue, int offset, int count);     public static string UrlEncode(string value);     public static byte[] UrlEncodeToBytes(byte[] value, int offset, int count); } 
like image 135
Scott Dorman Avatar answered Sep 22 '22 11:09

Scott Dorman