c# - How to allow unicode characters in web.config for my MVC application? -
i wanted add cool characters names , added in web.config picture of cow, this.
<add key="sendername" value="🏫 mr mooo"/>
however, when start application, exception on line in _layout.cshtml nagging localization , such.
@styles.render("~/content/css")
i'm not sure how handle this. apparently, mvc hates cows can it?
i've tried follow the suggested syntax according standard. added utf-16 @ top of config file.
this has nothing @ unicode characters , xml escaping.
as stated in xml standard linked to, xml defines 5 standard entities:
- < represents "<";
- > represents ">";
- & represents "&";
- ' represents "'";
- " represents '"'.
all other entities (such 🏫
) not valid in xml unless explicitly define them.
there easy way out of situation, though. problem entity contains ampersand not escaped, makes incompatible xml. need escape , right world.
<add key="sendername" value="&#x1f3eb; mr mooo"/>
now application receive unescaped string want: 🏫 mr mooo
when retrieve config file, , can pass on view.
Comments
Post a Comment