Probably you never had that need, but just in case you want to change the text encoding for a web service response, the one that is inside the XML declaration at the top, from UTF-8 to anything else... well... you cannot do it: that string is hard coded inside the web service runtime.
This post, "Encoding limitations in ASMX
", has a comment written by a member of the MS team that worked on that feature:
We decided not to do this feature for 3 reasons:
We found out later that in the real world #2 just isn't the case. If we'd known that we probably would have made a different decision.
- UTF-8 can represent all Unicode characters
- The Xml spec requires that all Xml processors understand UTF-8
- We were short for time and there were other interesting features to consider.
The most interesting is the 3rd reason: "We were short for time"...
This is one of the many situation were some specification are not followed, and software must deal also with "wrong" behaviors..