SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

really simple:

I have a visual webpart with danish letters (æøå) which is malformed when deployed - most likely as a result of the wrong characterset encoding. How would I go about specifying this in a webpart?

I know you can use the Page directive in normal pages, but I don't know how to do it in a webpart?

share|improve this question
Just to exclude this clientside option: Your browser shows other danish sites in correct encoding? And other user that want to use this webpart also have access to correct encoded danish sites? – Shegit Brahm Apr 12 '12 at 9:32
Yes - it isn't the browser :) – Dynde Apr 12 '12 at 9:52
up vote 2 down vote accepted

You can't change to encoding for a single webpart but you can enter the characters as entities like:

æ ø å Æ Ø and Å giving æ ø å Æ Ø and Å

share|improve this answer
Yeah, I knew that. But a) that's a hassle, and b) what about dynamic content? – Dynde Apr 13 '12 at 5:16
Well a single webpart can't use another encoding than what's enabled through the pages Content-Type meta tag. And for dynamic content you'll ALWAYS use HtmlUtility.HtmlEncode anyway – Per Jakobsen Apr 13 '12 at 5:52
Good point. I was hoping for that far-fetched solution or workaround that didn't mean manually encoding the characters though. No such luck I guess. – Dynde Apr 13 '12 at 6:45
@Dynde All dynamic content should be encoded anyways and not just typed out raw. I'd imagine that you may need to test how the content editor behaves natively and see if you need some other input editor that you have more control over. – Roman Apr 14 '12 at 2:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.