I have an incomprehensible problem. I'm making an ASP.NET site and I want to stretch microdata to my site. I have the following microdata for HTML code
@model ListPlatformsVM
@section Microdata {
<script type="application/ld+json">
{
"@@context": "https://schema.org/",
"@@type": "BreadcrumbList",
"itemListElement": [
{
"@@type": "ListItem",
"position": "1",
"name": "@Model.str",
"item": "@Url.GetRouteUrl(EReviewerRoute.HomePage)"
},
{
"@@type": "ListItem",
"position": "2",
"name": "тестовий текст",
"item": "@Url.GetRouteUrl(EReviewerRoute.Platforms)"
}
]
}
</script>
}
As you can see, I am passing the @Model.str variable from the model to the microdata. str is of type string (UTF-16). By breakpoints it is clear that the text in str is normal, but I get this result
Instead of my text in Ukrainian, strange characters are displayed тест
There are a couple of other things that might help:
I want to display Ukrainian text using a variable passing it to the html code. Please help me, thanks in advance
Try using HtmlHelper.Raw
method:
Wraps HTML markup in a
HtmlString
, without HTML-encoding the specified value.
"name": "@Html.Raw(Model.str)"