How can I "decode" the value of `รง` in C #

I have a line with diacritical text. The string is encoded in code behind before ç

, and then rendered as ç

. I need a string to render, but it is not clear to me how to do this from C # on the back.

I tried .ToString()

and HttpUtility.HtmlDecode

, but the webpage still displays ç

รง instead, which is what it should display.

How can I "decode" a value ç

in C #?

The code is below. Field CountryName

.

var countryList = (from x in listDataRow
                   join y in genericNameValueMetadataItemList on x.Field<string>("CountryISO") equals y.Value.Text into countryGroup
                   from item in countryGroup.DefaultIfEmpty(defaultGenericNameValueMetadataItem)
                   select new Country
                   {
                       CountryISO = x.Field<string>("CountryISO"),
                       CountryName = (!item.Title.Text.IsNullOrEmpty()) ? item.Title.Text : HttpUtility.HtmlDecode(x.Field<string>("CountryName"))

                   }).OrderBy(x => x.CountryName).ToList();

      

The following code works fine in a console app for me. Could the problem come from LINQ syntax?

Console.WriteLine(System.Web.HttpUtility.HtmlDecode("Cura&#231;ao"));
Console.WriteLine(System.Net.WebUtility.HtmlDecode("Cura&#231;ao"));

      

UPDATE:

The problem was that I needed to wrap the code item.Title.Text

with the HtmlDecode function as well as the code x.Field<string>("CountryName"))

.

+3


source to share


1 answer


The problem was that I needed to wrap the code item.Title.Text

with the HtmlDecode function as well as the code x.Field<string>("CountryName"))

.



0


source







All Articles