Tuesday, March 06, 2007

Invalid Charater Error in Web.config file

Had a bit of a problem that was quite easily solved today. I was trying to substitute a curency pound symbol for a euro symbol in a web application, so I decided to make it configurable in the web.config file.
When I added it in however, I kept getting an error saying:

There is an invalid character in the given encoding

If I took out the line, or replaced it with another string, it worked fine. Turned out it was the encoding set in the top of the web config file. I changed to to read:

xml version ="1.0" encoding="windows-1252"

And it started to work fine. Not sure what that encoding refers to, but ill find out. I know I should really get the currency symbol from the local of the machine, but I don't know how!

No comments: