Here is my problem: I add a message to ModelError with addModelError(String.Empty,”My message”)
.
In my view I just call @Html.ValidationSummary().
The message is in German and the characters Ö, Ä, Ü are just shown as questionmark. How do I change that?
Asked
Active
Viewed 199 times
2

Tushar Gupta
- 15,504
- 1
- 29
- 47

Sknecht
- 984
- 2
- 11
- 31
-
Could you show your web.config? – Darin Dimitrov Apr 18 '16 at 10:47
-
1check out these SO posts..http://stackoverflow.com/questions/6638031/how-to-include-a-link-in-addmodelerror-message, http://stackoverflow.com/questions/727160/modelstate-addmodelerror-encodes-html – Kartikeya Khosla Apr 18 '16 at 10:47
-
You can use Globalization . But have you tried with `HTML.Raw()` ? – Tushar Gupta Apr 18 '16 at 10:49
-
Html.Raw does not work. The message gets encoded before send to the view. – Sknecht Apr 18 '16 at 12:34
1 Answers
0
As I see it there are two options. One option is to write a custom validation summary helper which doesn't HTML encode the messages like described in the link that Kartikeya Khosla provided. Or, and that’s what I did, Just use the Unicode reference in the message string. The solution in Kartikeya is more elegant, but in my case it is a lot of code to change two characters. By the way here a link to look them up if anybody wants to do the same:
http://www.utf8-chartable.de/unicode-utf8-table.pl?utf8=oct&unicodeinhtml=dec&htmlent=1

Sknecht
- 984
- 2
- 11
- 31