Josh
Josh

Reputation: 10624

Special characters not returned correctly

I have the following German phrase in a view of my .Net MVC application:

auf der Straße

but when I look at the source that is returned

 auf der Straße 

I can see that it doesn't match what is in the view. I have set the Thread's UI culture to 'de-DE' and the CurrentUICulture to 'de-DE'

 Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("de-DE");
 Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("de-DE");

In my web.config file, I've set the request and response encoding to utf-8:

<globalization requestEncoding="utf-8" responseEncoding="utf-8" />

Anything else I can check to figure out how to return the text that is in the view and not something else?

Upvotes: 1

Views: 59

Answers (1)

Josh
Josh

Reputation: 10624

Turns out, you need the fileEncoding set to UTF-8 as well, otherwise the text that is sent from the server is not correct.

<globalization requestEncoding="UTF-8" responseEncoding="UTF-8" fileEncoding="UTF-8" />

Upvotes: 1

Related Questions