开发者

Special characters in web.config

I've create a custom configuration section in my web.config file for my 3.5 web application. The custom configuration contains special characters listed below.

  <add Key="2" String="â€"/>
  <add Key="3" String="148"/>
  <add Key="4" String="!X"/>
  <add Key="5" String="¡§"/>
  <add Key="6" String="¡¦"/>
  <add Key="7" String="¡¨"/>
  <add Key="8" String="’" />
  <add Key="9" String="–" />

I currently have the xml type of the web.config defined as below.

<?xml version="1.0"?>

This works fine in one development environment, but when I migrate the application to another environment I get an xml parsing error on the string for Key 2. When I replace all the string definitions for each config entry with standard alpha chars, the application works fine. Is there a way to enforce the XML to be re开发者_高级运维ad the same way? I have looked into the encoding attribute for the xml definition tag, just not positive what to set it to. Any guidance would be well appreciated. Thanks in advance.


I recommend setting the encoding to "utf-8". Make sure the file is also actually saved as utf-8.


Are you typing these into your web.config file manually? Can't you just HTML-encode your string values?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜