[Mono-dev] Re: [Mono-devel-list] mcs patch for default encoding

Kornél Pál kornelpal at hotmail.com
Mon Aug 22 04:43:39 EDT 2005


Hi,

I think using 1252 as a fallback is better than UTF-8 as it is a regular
single-byte code page. UTF-8 should be detected (and I think it is detected)
using byte order marks anyway.

I agree that using 28591 as the default encoding is is a bad decission.

What about using Encoding.Default instead of
CultureInfo.CurrentCulture.TextInfo.ANSICodePage as it is really based on
system code page?

Kornél

----- Original Message -----
From: "Atsushi Eno" <atsushi at ximian.com>
To: "mono-devel mailing list" <mono-devel-list at lists.ximian.com>
Sent: Monday, August 22, 2005 7:59 AM
Subject: [Mono-dev] Re: [Mono-devel-list] mcs patch for default encoding


> Any comments on this patch? If we leave this problem as is, most
> of native-language dependent applications won't compile fine
> (as I experienced on many Japanese sources).
>
> Atsushi Eno
>
> Atsushi Eno wrote:
>> Hello,
>>
>> I've attached a fix for mcs to not use Latin1 encoding everywhere.
>> I think it should be default encoding of current culture (for
>> example the codepage is 932 on my Japanese environment, neither
>> 28591 nor 1252).
>>
>> But in case we really don't have the corresponding encoding that
>> CultureInfo.CurrentCulture.TextInfo indicates (it should be
>> supplied though), we should use culture-independent encoding, so
>> I think it should be utf-8, instead of iso-8859-1.
>>
>> Atsushi Eno
>>
>>
>> ------------------------------------------------------------------------
>>
>> Index: driver.cs
>> ===================================================================
>> --- driver.cs (revision 47877)
>> +++ driver.cs (working copy)
>> @@ -1374,10 +1374,10 @@
>>  bool parsing_options = true;
>>
>>  try {
>> - encoding = Encoding.GetEncoding (28591);
>> + encoding = Encoding.GetEncoding
>> (CultureInfo.CurrentCulture.TextInfo.ANSICodePage);
>>  } catch {
>>  Console.WriteLine ("Error: could not load encoding 28591, trying 1252");
>> - encoding = Encoding.GetEncoding (1252);
>> + encoding = Encoding.UTF8;
>>  }
>>
>>  references = new ArrayList ();
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Mono-devel-list mailing list
>> Mono-devel-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>




More information about the Mono-devel-list mailing list