It is set to utf-8 and tried to add the line of code that Dennis posted but nothing changed.
I am using Visual Studio and I have saved it with encoding "Unicode (UTF-8 with signature) - Codepage 65001 - But no change after this.
Is this the same as with BOM, because I cant find the option "With BOM".
It is strange that it is only Alt text and Meta description that have problems with special characters. Does it have something to do with how it is stored in the database?
Is it wrong to use special character in Meta and Alt descriptions?
If I directly insert æøå in the HTML, then it shows æøå without any problems.
I have testet the Fanoe starter kit and the problem is also appearing here.
Can't remember how to save with or without BOM using VS. It may be called something different.
But I was thinking of the issue where ÆØÅ characters are messed up when rendering on the page. I have seen this issue before as well but can't currently remember how to fix it.
Does it also happen if you try to create a partial view macro for rendering the fields?
I have tried to make a partial view, but still the same problem. But you asked me to try with a partial view macro and i don't know how to do that. :-(
On earlier webpages I have used this code without any problems. I am aware that it can´t be used anymore.
Ok, if you already tried making a partial then nevermind - Using a partial view macro will end up with the same result I think. I'll try to see if I can flick something together in order to test this...something in the back of my mind tells me I've seen it before.
Seems that no matter where my text is coming from (rich text editor, textfield, textstring) then all special characters like danish æ,ø,å and apostrophes will be entity encoded for some reason.
I'm not sure it's an Umbraco specific thing though since I just tested on a Sitecore solution I have been working on where I see the same issue. So I suspect it might be related to .net / mvc somehow. I also checked an older site of mine, which is running Umbraco 4.7 (and therefore based on webforms) and here the special characters are not being entity encoded.
Even though it seems a bit annoying it should not be a serious issue though since Google and other search engines will still be able to display the entities correctly as long as they're being properly encoded.
I'm confident that our Sitecore client and our marketing department would have made som serious noise if the entities influenced how search results looked in SERP because of the entity encoding :D - So I don't think you should worry too much about it.
But if you feel like it you can always try and file an issue at the issue tracker
Thank you for looking into this problem. With your description I am convinced that it is not a problem especially the part "Google and other search engines will still be able to display the entities correctly".
I have only been testing looking at the source code through the browser.
As usual you're very welcome :) It got my curious since it used to be displayed correctly and could potentially be a serious issue - But as we found out it's not :)
Just a little update on this subject. Before you posted your answer I asked the same question on stackoverflow and got an answer from sebastiaan. He actually posted a (ugly) solution but at the same time he confirmed your answer.
Special characters in meta and alt text
Hi
I have a problem when using special characters in meta and alt text.
Meta description and Alt text like this: Test test æøå
Generates this output:
If I insert the same text in title tags and normal content, then the output is just perfect.
The code that is generating the meta and title tags looks like this:
Does anybody know whats wrong?
// René
Hi René
Perhaps you should set this meta tag in to your master template in the head section, to ensure that it uses UTF-8 encoding.
Hope this helps,
/Dennis
Hi René
Are you using UTF-8 when saving your files? I have noticed that sometimes you need to save the files as UTF-8 with BOM for some reason.
If you're using Visual Studio or Sublime Text you can use the "Save with encoding" option to see if it works.
Otherwise using
<meta charset="UTF-8">
should be enough./Jan
Hi Dennis and Jan
It is set to utf-8 and tried to add the line of code that Dennis posted but nothing changed.
I am using Visual Studio and I have saved it with encoding "Unicode (UTF-8 with signature) - Codepage 65001 - But no change after this.
Is this the same as with BOM, because I cant find the option "With BOM".
It is strange that it is only Alt text and Meta description that have problems with special characters. Does it have something to do with how it is stored in the database?
Is it wrong to use special character in Meta and Alt descriptions?
If I directly insert æøå in the HTML, then it shows æøå without any problems.
I have testet the Fanoe starter kit and the problem is also appearing here.
I have also tried to:
And then it shows the "æøå" correctly.
// René
Hi René
Can't remember how to save with or without BOM using VS. It may be called something different.
But I was thinking of the issue where ÆØÅ characters are messed up when rendering on the page. I have seen this issue before as well but can't currently remember how to fix it.
Does it also happen if you try to create a partial view macro for rendering the fields?
/Jan
Hej Jan
I have tried to make a partial view, but still the same problem. But you asked me to try with a partial view macro and i don't know how to do that. :-(
On earlier webpages I have used this code without any problems. I am aware that it can´t be used anymore.
I found this topic which descripes excatly the same problem:
https://our.umbraco.org/forum/umbraco-7/using-umbraco-7/56401-Textbox-multiple-encoding
// René
Hi René
Ok, if you already tried making a partial then nevermind - Using a partial view macro will end up with the same result I think. I'll try to see if I can flick something together in order to test this...something in the back of my mind tells me I've seen it before.
I'll get back to you.
/Jan
Hi René
Ok, just did some testing of my own.
Seems that no matter where my text is coming from (rich text editor, textfield, textstring) then all special characters like danish æ,ø,å and apostrophes will be entity encoded for some reason.
I'm not sure it's an Umbraco specific thing though since I just tested on a Sitecore solution I have been working on where I see the same issue. So I suspect it might be related to .net / mvc somehow. I also checked an older site of mine, which is running Umbraco 4.7 (and therefore based on webforms) and here the special characters are not being entity encoded.
Even though it seems a bit annoying it should not be a serious issue though since Google and other search engines will still be able to display the entities correctly as long as they're being properly encoded.
I'm confident that our Sitecore client and our marketing department would have made som serious noise if the entities influenced how search results looked in SERP because of the entity encoding :D - So I don't think you should worry too much about it.
But if you feel like it you can always try and file an issue at the issue tracker
Hope this helps.
/Jan
Hi Jan
Thank you for looking into this problem. With your description I am convinced that it is not a problem especially the part "Google and other search engines will still be able to display the entities correctly".
I have only been testing looking at the source code through the browser.
Thanks once again!
// René
Hi René
As usual you're very welcome :) It got my curious since it used to be displayed correctly and could potentially be a serious issue - But as we found out it's not :)
Happy coding mate!
/Jan
Hi Jan
Just a little update on this subject. Before you posted your answer I asked the same question on stackoverflow and got an answer from sebastiaan. He actually posted a (ugly) solution but at the same time he confirmed your answer.
See: http://stackoverflow.com/questions/29101236/meta-description-with-special-characters-in-umbraco/29105081?noredirect=1#comment46483433_29105081
// René
is working on a reply...