Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to allow unicode characters in web.config for my MVC application?

I wanted to add some cool characters to the names and added in my web.config a picture of a cow, like this.

<add key="SenderName" value="&#x1f3eb; Mr Mooo"/>

However, when I start the application, I get an exception on this line in my _Layout.cshtml nagging about localization and such.

@Styles.Render("~/Content/css")

I'm not sure how to handle this. Apparently, the MVC hates cows but what can I do about it?

I've tried to follow the suggested syntax according to the standard. I also added UTF-16 at the top of the config file.

like image 701
Konrad Viltersten Avatar asked Oct 18 '22 11:10

Konrad Viltersten


1 Answers

Try to set encoding both in header and in configuration node for system.web- set globalization node "fileEncoding" attribute to utf-16.

<?xml version="1.0" encoding="utf-16"?>
<configuration>
  <system.web>
    <globalization fileEncoding="utf-16" requestEncoding="utf-16" responseEncoding="utf-16"/>
  </system.web>
</configuration>

P.S. Sorry - last time I was typing from my tablet so it was hard to wrote an example.

like image 133
VitaliyK Avatar answered Oct 21 '22 04:10

VitaliyK