Server 2003 SP1 introduced "enableBestFitResponseEncoding" setting

G

Guest

Hello,

SP1 of Windows Server introduced a new "feature" in the GlobalizationConfig
class
called EnableBestFitResponseEncoding.

Effect is that when you set anything other than UTF8 in web.config, e.g.
<globalization requestEncoding="iso-8859-1" responseEncoding="iso-8859-1" />,
many functions will break (including HttpUtility.URLDecode) with a
MethodNotImplementedExecption in the new internal class
CodePageNoBestFitEncoding.

Analyzing with the reflector reveals, that new code was added to the
HttpResponse.ContentEncoding property:

if (!this._encoding.Equals(Encoding.UTF8))
{
string text1 = this._encoding.GetType().FullName;
if ((config1 == null) ||
!config1.EnableBestFitResponseEncoding)
{
if (text1 ==
"System.Text.MLangCodePageEncoding")
{
this._encoding =
Encoding.GetEncoding("mlang");
}
else if ((text1 ==
"System.Text.CodePageEncoding") || (text1 == "System.Text.Latin1Encoding"))
{
int num1 = this._encoding.CodePage;
this._encoding = new
CodePageNoBestFitEncoding(num1);
}
}

Assuming that EnableBestFitResponseEncoding is false by default, this property
will return a new instance of CodePageNoBestFitEncoding when you set a
responseEncoding="iso-8859-1" in web.config.

Many of the normal Encoding methods in CodePageNoBestFitEncoding will throw
the MethodNotImplemented exception which explains the above mentioned
bahavior.
Some additional analysis reveals that there is a new attribute for
<globalization > called "enableBestFitResponseEncoding". After setting this
attribute
to "true", everthing works again as normal with a responseEncoding other than
UTF8.
I did not find any documentation about this new attribute.
Can anyone give us some hints ?

Best Regards,
Torsten Sturm
hotel.de AG
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top