DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2722
Version: 1.3-current


When a widget has a label Fluid truncates it (as byte string) and prints
the UTF8 string incorrectly in half cases, approximately.
I would use fl_utf8decode() to avoid of splitting the UTF8 symbols.

For example:
@@ -323,9 +314,13 @@ void Widget_Browser::item_draw(void *v,
     } else if ((c=l->label())) {
       char buf[50]; char* p = buf;
       *p++ = '"';
-      for (int i = 20; i--;) {
+      int b,l=strlen(c);
+      for (int i = 20; i>0;) {
         if (! (*c & -32)) break;
-        *p++ = *c++;
+        fl_utf8decode(c, c+l, &b);
+        if (b==-1 || i-b<0) break;
+        l-=b;i-=b;
+        while (b--)*p++ = *c++;
       }
       if (*c) {strcpy(p,"..."); p+=3;}
       *p++ = '"';


Link: http://www.fltk.org/str.php?L2722
Version: 1.3-current

<<attachment: fluid_utf8.jpg>>

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

Reply via email to