question

SKana-3049 avatar image
0 Votes"
SKana-3049 asked YijingSun-MSFT commented

Microsoft Edge browser displays apostrophe as &39;

I have asp.net dropdownlist contol which is populated with names from database, and if a name consists of apostrophe its displaye wiredly as &39; For example if the name is O'Connell, Daniel its displayed as O&39;Connell, Daniel,
This is happening when I run this app in Microsoft Edge, PLease let me know any fix to it.

THanks

dotnet-aspnet-webpages
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @SKana-3049,
I don't make sure your problems caused by Browser. You said the data from database. I suggest you need to check:
1.You could view in Design or debug to check if the data come from database is the right format.
2.You could use other Browsers like IE,Firefox to check if all Browsers have the same problems.
Best regards,
Yijing Sun

0 Votes 0 ·

1 Answer

SKana-3049 avatar image
0 Votes"
SKana-3049 answered YijingSun-MSFT commented

Hi, Yijing thanks for the response but, Im using
ddlDnuEdit.Items.Add(new ListItem(HttpUtility.HtmlEncode(item.ID), HttpUtility.HtmlEncode(item.Name)));

HtmlEncode is causing a problem?

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @Skana-3049,
Do you have used HtmlDecode with HtmlEncode? The input string is encoded using the HtmlEncode method. The encoded string obtained is then decoded using the HtmlDecode method.
https://docs.microsoft.com/en-us/dotnet/api/system.web.httputility.htmlencode?view=net-5.0
Best regards,
Yijing Sun

0 Votes 0 ·