Author: leo
Date: Tue Nov 15 17:37:08 2005
New Revision: 10007

Modified:
   trunk/charset/unicode.c
   trunk/t/op/string_cs.t
Log:
unicode charsets - fix upcase, downcase, titlecase

* the ICU error wasn't cleared before retrying after reallocating the string
* test upcasing  "hacek j" - see also p5p weekly summary 
  Disscussion at http://xrl.us/ifnn (use.perl.org)

Failing: t/op/string_cs_44 - but expected could be wrong also.


Modified: trunk/charset/unicode.c
==============================================================================
--- trunk/charset/unicode.c     (original)
+++ trunk/charset/unicode.c     Tue Nov 15 17:37:08 2005
@@ -106,6 +106,7 @@ u_strToUpper(UChar *dest, int32_t destCa
             &err);
     src->bufused = dest_len * sizeof(UChar);
     if (!U_SUCCESS(err)) {
+        err = U_ZERO_ERROR;
         Parrot_reallocate_string(interpreter, src, src->bufused);
         dest_len = u_strToUpper(src->strstart, dest_len,
                 src->strstart, src_len,
@@ -146,6 +147,7 @@ u_strToLower(UChar *dest, int32_t destCa
             &err);
     src->bufused = dest_len * sizeof(UChar);
     if (!U_SUCCESS(err)) {
+        err = U_ZERO_ERROR;
         Parrot_reallocate_string(interpreter, src, src->bufused);
         dest_len = u_strToLower(src->strstart, dest_len,
                 src->strstart, src_len,
@@ -188,6 +190,7 @@ u_strToTitle(UChar *dest, int32_t destCa
             &err);
     src->bufused = dest_len * sizeof(UChar);
     if (!U_SUCCESS(err)) {
+        err = U_ZERO_ERROR;
         Parrot_reallocate_string(interpreter, src, src->bufused);
         dest_len = u_strToTitle(src->strstart, dest_len,
                 src->strstart, src_len,

Modified: trunk/t/op/string_cs.t
==============================================================================
--- trunk/t/op/string_cs.t      (original)
+++ trunk/t/op/string_cs.t      Tue Nov 15 17:37:08 2005
@@ -16,7 +16,7 @@ Tests charset support.
 
 =cut
 
-use Parrot::Test tests => 48;
+use Parrot::Test tests => 49;
 use Parrot::Config;
 use Test::More;
 
@@ -718,6 +718,18 @@ CODE
 T\x{c3}\x{96}TSCH
 OUTPUT
 
+output_is( <<'CODE', <<"OUTPUT", "unicode upcase to combined char");
+    set S1, unicode:"hacek j \u01f0"
+    upcase S1
+    getstdout P0          # need to convert back to utf8
+    push P0, "utf8"       # push utf8 output layer
+    print S1
+    print "\n"
+    end
+CODE
+HACEK J J\xcc\x8c
+OUTPUT
+
 output_is( <<'CODE', <<"OUTPUT", "unicode titlecase");
     set S0, iso-8859-1:"t�tsch leo"
     find_charset I0, "unicode"

Reply via email to