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 asp.net pages, but I don't know how to do it in a webpart?

  • 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? Commented Apr 12, 2012 at 9:32
  • Yes - it isn't the browser :)
    – Dynde
    Commented Apr 12, 2012 at 9:52

1 Answer 1


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

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

  • Yeah, I knew that. But a) that's a hassle, and b) what about dynamic content?
    – Dynde
    Commented Apr 13, 2012 at 5:16
  • 1
    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 Commented Apr 13, 2012 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
    Commented Apr 13, 2012 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
    Commented Apr 14, 2012 at 2:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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