Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

asp.net mvc. Display html string from database

I need to display a data from a database which contains strings like & or «. When I try to display them through Html.Raw or Html.Encode, I've got dublicates values like & for Html.Raw and also bad output for Html.Encode.

What should I try? I use Razor syntax.

Example string: Hello, my name is Junior & I hate «bugs».

like image 879
user1399542 Avatar asked Dec 16 '22 00:12

user1399542


1 Answers

As per the comments at the top:

the @Html.Raw(string) should be the proper syntax. Are you sure the string data in the database is not already escaped?

like image 106
Jeremy Holovacs Avatar answered Jan 04 '23 11:01

Jeremy Holovacs