Is there a way to set charset using the web.config in asp.net?
-
06-07-2019 - |
Question
Recently I came across a situation where, while using a double-byte language, I had to enter the charset as a metatag.
Previously I had thought that the globalization tag in the web.config would handle the page charset, but this seems not to be the case.
Is there a way to set charset in the web.config or a way to set the charset of an entire web site without having to enter the metatag on every page?
Solution
Doesn't setting the responseEncoding in the globalization element in the web.config like this, work?
<configuration>
<system.web>
<globalization
fileEncoding="utf-8"
requestEncoding="utf-8"
responseEncoding=""
culture="en-US"
uiCulture="de-DE"
/>
</system.web>
</configuration>
Otherwise, use a basepage and set the charset in there, but that's a lot of work.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow