Swedish special characters

Topics: General, Troubleshooting
Jan 23, 2012 at 4:23 PM

Hi!

Iam quite new to orchard and mvc. I have some problems displaying swedish special characters like åäö on my views.

For an example in my code i have written:"<label>Beställare</label>" and when i run the page its become Best¤llare, when i take view source its shows <label>Best¤llare</label>. I have tried to set a different charset and html lang ect. Nothing works, does someone have any ideas of whats the problem?

Jan 23, 2012 at 7:17 PM

i can add that is works perfectly when my view is a razor cshtml but the problem is when i use a aspx as a view...

Developer
Jan 23, 2012 at 8:51 PM

I've seen this frequently happen if a string is html-encoded more than twice. But if you directly write the string into the view and not outputting a variable with @ then I have no clue.

Coordinator
Jan 25, 2012 at 4:29 AM

That's a charset issue. Are you maybe using a theme that is setting the charset in document.cshtml?

Jan 25, 2012 at 6:08 AM

Hi,

Thx for the input, i am using TheThemeMachine as a Theme and u are right that the theme is setting the charset in document.cshtml. My question is where i should put it instead?.  

Coordinator
Jan 25, 2012 at 6:23 AM

There is no document.cshtml in the theme machine that we ship. It must have been added. Anyways, the question is not where it's set but what it's set to. It should be UTF-8. Is it something else?

Jan 25, 2012 at 7:34 AM

I have mad some research, i came up with that i don´t use the TheThemeMachine as a theme, the theme i use custom theme that is a childtheme and inherits from thethememachine.  

When i take view source on my viewpage i have the <meta charset="utf-8" /> in the header tag, the problem is (atleast i think) that i have two header and body tags, one from the document.cshtml and one from my view. I will try to change back to the default theme and se if it works.

 

 

Jan 25, 2012 at 7:46 AM

I have changed back to TheThemeMachine but the problem remains, However the problem only occurs when my viewpage is a .aspx and not when i use a .cshtml.

Coordinator
Jan 25, 2012 at 7:47 AM

And why are you using an aspx?

Jan 25, 2012 at 8:03 AM

i don´t realy have a good answer to that, why not?, what are the pros of using cshtml compare to aspx? beside that the characters works =)

Coordinator
Jan 26, 2012 at 4:53 AM

All of Orchard is using cshtml. It's more modern, too.