[Mono-dev] Unhandled Exception in Normalization.cs Combine()

Tom Philpot tom.philpot at logos.com
Fri Jun 12 13:45:58 EDT 2009


The following program throws an UnhandledException when trying to normalize
a series of greek characters. I’ve tested this with Mono 2.4.7 and the
latest code from SVN as of about 1 week ago.
The same program works fine under Visual Studio.

I’m new to Unicode, but I thought I’d put this out there to see if anyone
had a quick fix.

using System;
using System.Text;

namespace NormalizationTest
{
    class Program
    {
        static void Main(string[] args)
        {
            byte[] utf8Bytes = new byte[] {0xCE, 0xB1, 0xCC, 0x93, 0xCD,
0x85};
            string strToNormalize =
System.Text.Encoding.UTF8.GetString(utf8Bytes);
            Console.WriteLine("Converted from Hex: {0}", strToNormalize);
            
            Console.WriteLine("Composed Normalized String:
IsNormalized(NormalizationForm.FormC)  = {0}",
strToNormalize.IsNormalized(NormalizationForm.FormC));
            Console.WriteLine("{0}",
strToNormalize.Normalize(NormalizationForm.FormC));
        }
    }
}

---- Output ---
WS1048:Debug tom.philpot$ /opt/mono/bin/gmcs NormTest.cs /out:NormTest.exe
&& /opt/mono/bin/mono --debug NormTest.exe
Converted from Hex: ᾀ
Composed Normalized String: IsNormalized(NormalizationForm.FormC)  = False

Unhandled Exception: System.SystemException: Internal error: should not
happen.
  at Mono.Globalization.Unicode.Normalization.Combine
(System.Text.StringBuilder sb, Int32 start, Int32 checkType) [0x00198] in
/Users/tom.philpot/External/mono-project/mcs/class/corlib/Mono.Globalization
.Unicode/Normalization.cs:206
  at Mono.Globalization.Unicode.Normalization.Combine (System.String source,
Int32 start, Int32 checkType) [0x0003c] in
/Users/tom.philpot/External/mono-project/mcs/class/corlib/Mono.Globalization
.Unicode/Normalization.cs:135
  at Mono.Globalization.Unicode.Normalization.Compose (System.String source,
Int32 checkType) [0x00011] in
/Users/tom.philpot/External/mono-project/mcs/class/corlib/Mono.Globalization
.Unicode/Normalization.cs:121
  at Mono.Globalization.Unicode.Normalization.Normalize (System.String
source, Int32 type) [0x00015] in
/Users/tom.philpot/External/mono-project/mcs/class/corlib/Mono.Globalization
.Unicode/Normalization.cs:392
  at System.String.Normalize (NormalizationForm normalizationForm) [0x00023]
in 
/Users/tom.philpot/External/mono-project/mcs/class/corlib/System/String.cs:1
442 
  at NormalizationTest.Program.Main (System.String[] args) [0x00000]


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20090612/daba2133/attachment.html 


More information about the Mono-devel-list mailing list