1-) C# RMOS - html character to string
1- YENİ YOL Regex.Unescape Yaparsan u0027 bu gibi ifadeleri düzeltir
// u0027\u003e3.985,20 ₺\u003c string duzeltilmisMetin = Regex.Unescape(metin); |
public string replaceTurkish(string text)
{
var json = @"{""name"":"""+ text + @"""}";
var name = JObject.Parse(json)["name"].ToString();
return name.ToString();
}
KULLANIMI
var name = replaceTurkish("Hills Young Sterilised Tavuklu K\u0131s\u0131rla\u015ft\u0131r\u0131lm\u0131\u015f Kedi Mamas\u0131 1.5 Kg")
DİĞER
string result = responseOtel.Content.ReadAsStringAsync().Result;
result=System.Net.WebUtility.HtmlDecode(result);
kaynak : https://stackoverflow.com/questions/13492497/converting-html-entities-to-unicode-characters-in-c-sharp
string s = System.Net.WebUtility.HtmlDecode("é"); // içine senin stringin gelecek yani
string s1 = System.Net.WebUtility.HtmlDecode(htmlstring);
2-) html character to string
kaynak : https://stackoverflow.com/questions/1615559/convert-a-unicode-string-to-an-escaped-ascii-string
public static string DecodeEncodedNonAsciiCharacters( string value ) {
return Regex.Replace(
value,
@"\\u(?<Value>[a-zA-Z0-9]{4})",
m => {
return ((char) int.Parse( m.Groups["Value"].Value, NumberStyles.HexNumber )).ToString();
} );
}
encoding decoding httpclient webclient