I'm trying to show some text between html tags, I'm using @HTML.Raw method to accomplish this, the code snippet look like this:
<!-- SEO -->
<title>@Html.Raw(Model.Title)</title>
<meta name="Description" content="@Html.Raw(Model.Description)">
<meta name="KEYWORDS" content="@Html.Raw(Model.Keywords)">
<!-- END SEO -->
Description: @Html.Raw(Model.Description)
Keywords: @Html.Raw(Model.Keywords)
But after the code execute, it show like this:
<!-- SEO -->
<title>FÚTBOL - El portal de los hinchas del fútbol</title>
<meta name="Description" content="FÚTBOL - El portal de los hinchas del fútbol">
<meta name="KEYWORDS" content="Fútbol,hinchas">
<!-- END SEO -->
Description: FÚTBOL - El portal de los hinchas del fútbol
Keywords: Fútbol, hinchas
Something happend when the escaped string is between the " character.
Does anyone know why is this happening?
EDIT
The content of the variables is exactly like this:
Title: FÚTBOL - El portal de los hinchas del fútbol
Description: FÚTBOL - El portal de los hinchas del fútbol
Keywords: Fútbol, hinchas
The charset and the doctype in my _Layout is:
<!DOCTYPE html>
<html lang="es" xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:og="http://ogp.me/ns#">
<head>
<meta charset="utf-8" />
The problem is not the case of the letters its ok that its shows Ú or ú. What i dont unserstand is why its escape the letter in one case and not in the other,
My suggestion is use @Html.Raw("your string") whenever you want to force the Raw string.
Since &x250;
is "ú" and 218 is "Ú" what is the problem? You're just seeing some cases of using an HTML entity and not in other cases.
Providing you're delivering the output with a suitable encoding the end result will be the same – with the entities it'll be the client doing the un-encoding.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With