Problems with the default CodePage and OEMCodePage under the Mono distributed with 8.04

Aquil H. Abdullah aquil.abdullah at gmail.com
Thu May 29 08:34:11 UTC 2008


Hello All,
  I wasn't sure if this post should go to the user list or the developer
list so I am sending it to both.  There seems to be a bug in the Mono 1.2.6
that is distributed with the 8.04 TLS release.  I am developing .NET
applications using Mono, and my .NET Applications started breaking after my
OS upgrade  because of an unhandled exception being thrown when the encoding
of my system was being determined.

The .NET Framework has an Encoding class which resides in the System.Text
Namespace.  This class has a method GetEncoding which returns the encoding
associated with the specified code page identifier. A CodePage Identifier
Specifies a particular encoding, for example UTF-8, UTF-16, etc.  The
OEMCodePage for my system is 437 or IBM437 OEM United States. When I run the
following piece of code

using System;
using System.Text;
using System.Globalization;
using System.IO;

public class SamplesEncoding  {

  public static void Main()  {
    Encoding _encoding = null;
    Console.WriteLine("The OEM Code Page Identifire is {0}",
              CultureInfo.CurrentCulture.TextInfo.OEMCodePage);
    try{
    _encoding =
Encoding.GetEncoding(CultureInfo.CurrentCulture.TextInfo.OEMCodePage);
    }catch(NotSupportedException e){
      Console.WriteLine("You are toast got exception");
      Console.WriteLine(e.ToString());
      Environment.Exit(1);
    }
    Console.WriteLine("Exiting Normally, Goodbye");
  }

}

using the mono 1.2.6 runtime distributed with Ubuntu 8.04 I get the
following error:

aha at stanwyk:~/scratch/zip_test$ gmcs /out:encode_test.exe /t:exe encode.cs
encode.cs(9,14): warning CS0219: The variable `_encoding' is assigned but
its value is never used
Compilation succeeded - 1 warning(s)
aha at stanwyk:~/scratch/zip_test$ mono encode_test.exe
The OEM Code Page Identifire is 437
You are toast got exception
System.NotSupportedException: CodePage 437 not supported
  at System.Text.Encoding.GetEncoding (Int32 codePage) [0x00000]
  at SamplesEncoding.Main () [0x00000]

However, if I run the same assembly using the mono 1.2.6 that I compiled by
hand I get the following
The OEM Code Page Identifire is 437
Exiting Normally, Goodbye

I haven't had the chance to look at the differences between the source code
that I downloaded and compiled straight from Novell and the source code used
to build the Mono distributed with Ubuntu 8.04, but it appears as though
there may be a bug.

NOTE: I did not use any special flags when I compiled 1.2.6 I just typed:
./configre --prefix=/home/aha/tools/mono-1.2.6
make
make install

My system has a Dual Core AMD Athlon processor: AMD Athlon(tm) 64 X2 Dual
Core Processor 4800+.

If no one picks this up over the next couple of days I'll try to drill down
on the problem a little bit more.

Regards,

-- 
Aquil H. Abdullah
aquil.abdullah at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20080529/f35116cc/attachment.html>


More information about the ubuntu-users mailing list