Yes, there is some extra configuration + some extra code that you need to build into your project. Doing it on my website because I had the exact same issue. Need to find the code (it's Saturday...) and will post.
I'm wondering why it is so important for them that the characters are not encoded? I mean when they see the site it's going to show just fine as España isn't it?
I just checked a couple of danish sites we have done throughout the years where danish characters like æ,ø and å are also getting encoded. So far I have not heard that it should be a bad thing? In terms of indexing the site in search engines this should not matter either.
Jan: because the page looks ugly when you look at the source + every single char such as 'é' turns into 'Ӓ' ie 7 chars - I know bandwidth is cheap, but stil.
How do I display non-English characters eg. the Spanish ñ in Razor views without encoding them?
This might be an easy thing to fix.
I have a multi language site, the Spanish version of the site is set up to use the es-Es culture and the language is set as:
However, when any content is added in the CMS that contains special non-English characters, these are encoded when I checked the source:
There is a client requirement for these not to be encoded, when viewing source, it should be:
I know I can use Html.Raw() to not escape the characters, but this wouldn't work with other html entities like ampersand that need to be encoded.
Is there some extra configuration I need to do to change this?
Yes, there is some extra configuration + some extra code that you need to build into your project. Doing it on my website because I had the exact same issue. Need to find the code (it's Saturday...) and will post.
Hi Matt
I'm wondering why it is so important for them that the characters are not encoded? I mean when they see the site it's going to show just fine as España isn't it?
I just checked a couple of danish sites we have done throughout the years where danish characters like æ,ø and å are also getting encoded. So far I have not heard that it should be a bad thing? In terms of indexing the site in search engines this should not matter either.
/Jan
Jan: because the page looks ugly when you look at the source + every single char such as 'é' turns into 'Ӓ' ie 7 chars - I know bandwidth is cheap, but stil.
Aaah yes, I never thought of it in that context. But it makes sense #h5yr :-)
/Jan
There: https://www.zpqrtbnk.net/posts/lightweight-page-content-encoding
Stephen, that is awesome, that is a great article and is exactly what I need. H5YR
is working on a reply...