Author: matt
Date: 2011-10-01 09:26:06 -0700 (Sat, 01 Oct 2011)
New Revision: 9113
Log:
STR 2722: Fluid widget browser was not UTF8 reay yet.

Modified:
   branches/branch-3.0/fluid/Fl_Type.cxx

Modified: branches/branch-3.0/fluid/Fl_Type.cxx
===================================================================
--- branches/branch-3.0/fluid/Fl_Type.cxx       2011-10-01 16:25:30 UTC (rev 
9112)
+++ branches/branch-3.0/fluid/Fl_Type.cxx       2011-10-01 16:26:06 UTC (rev 
9113)
@@ -358,9 +358,13 @@
     } else if ((c=l->label())) {
       char buf[50]; char* p = buf;
       *p++ = '"';
-      for (int i = 20; i--;) {
-        if (! (*c & -32)) break;
-        *p++ = *c++;
+      int b,l=strlen(c);           // size in bytes
+      for (int i = 20; i>0;i--) {  // maximum 20 characters
+        if (*c==0) break;          // end of string
+        fltk3::utf8decode(c, c+l, &b); // b=size of char in bytes
+        if (b==-1) break;          // some error - leave
+        l-=b;                      // l = bytes left in string
+        while (b--)*p++ = *c++;    // copy that character into the buffer
       }
       if (*c) {strcpy(p,"..."); p+=3;}
       *p++ = '"';

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to