[Mono-dev] [PATCH] System.Text.Encoding.GetEncoding compatibility fixes

Gert Driesen gert.driesen at telenet.be
Thu Feb 1 08:17:32 EST 2007

----- Original Message ----- 
From: "Atsushi Eno" <atsushi at ximian.com>
To: "Gert Driesen" <gert.driesen at telenet.be>
Cc: <mono-devel-list at lists.ximian.com>
Sent: Thursday, February 01, 2007 1:44 PM
Subject: Re: [Mono-dev] [PATCH] System.Text.Encoding.GetEncoding 
compatibility fixes

> Hi,
> (I've already approved the patch but) I had to revert part of it since
> it broke the build. You can try to use non-Latin1 environment (e.g.
> CP932) to see how it breaks mcs tree.

I think I've found the culprid:

In Encoding.Default we're catching the NotSupportedException, so we can 
fallback to UTF8 (without BOM) if there's no encoding for the current locale 
or corresponding codepage.

This should be modified to catch both ArgumentException and 
NotSupportedException, since:

* GetEncoding(codepage) throws NotSupportedException when we have no 
encoding for the specified codepage
* GetEncoding(name) throws ArgumentException if "name is not a valid code 
page name, or if it's not supported by the underlying platform"

(partly quoted from MSDN)

I'll first run tests later today (using CP932) to verify this.


More information about the Mono-devel-list mailing list