Fourth patch from: Damien Diederen <dd@crosstwine.com>
authorMiguel de Icaza <miguel@gnome.org>
Thu, 22 Apr 2010 21:25:59 +0000 (21:25 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Thu, 22 Apr 2010 21:25:59 +0000 (21:25 -0000)
For bug: https://bugzilla.novell.com/show_bug.cgi?id=480152

     * Normalization.cs: The correct "checkType" argument to
Decompose() is NKD or NKFD when normalizing to NKC resp. NKFC.

* StringTest.cs: More NFC test cases.

svn path=/trunk/mcs/; revision=155965

mcs/class/corlib/Mono.Globalization.Unicode/ChangeLog
mcs/class/corlib/Mono.Globalization.Unicode/Normalization.cs
mcs/class/corlib/Test/System/StringTest.cs

index 194c87e7f7d5774befe45560e091aef90f9518aa..892f47bf5ef89b3e35671550103b063e8a6d3375 100644 (file)
@@ -1,3 +1,10 @@
+2010-04-20  Damien Diederen  <dd@crosstwine.com>
+
+       * Normalization.cs: The correct "checkType" argument to
+       Decompose() is NKD or NKFD when normalizing to NKC resp. NKFC.
+
+       * StringTest.cs: More NFC test cases.
+
 2010-04-20  Damien Diederen  <dd@crosstwine.com>
 
        * Normalization.cs: Implement algorithmic Hangul composition.
index 8d7fcfc84d4c8191737ecd132094d8136bec1af7..d49ad6c166d725306144d8c3b798ba2f917572bc 100644 (file)
@@ -56,7 +56,8 @@ namespace Mono.Globalization.Unicode
                private static string Compose (string source, int checkType)
                {
                        StringBuilder sb = null;
-                       Decompose (source, ref sb, checkType);
+                       // Decompose to NFD or NKFD depending on our target
+                       Decompose (source, ref sb, checkType == 2 ? 3 : 1);
                        if (sb == null)
                                sb = Combine (source, 0, checkType);
                        else
index e85a42f1aaceee26af1806d910b332130406827d..d8f51a3b9995bd802bc1674fe0961846dc0fef82 100644 (file)
@@ -4309,6 +4309,13 @@ public class StringTest
                Assert.AreEqual ("!\u116C".Normalize (NormalizationForm.FormC), "!\u116C", "#5");
                Assert.AreEqual ("!\u116B\u11C2".Normalize (NormalizationForm.FormC), "!\u116B\u11C2", "#6");
        }
+
+       [Test]
+       public void MoreNormalizeFormC ()
+       {
+               Assert.AreEqual ("\u1E0A\u0323".Normalize (NormalizationForm.FormC), "\u1E0C\u0307", "#1");
+               Assert.AreEqual ("\u0044\u0323\u0307".Normalize (NormalizationForm.FormC), "\u1E0C\u0307", "#2");
+       }
 #endif
        [Test]
        public void Emptiness ()