> With that example, I was trying to show a simple case of
> Fl_Help_View.cxx itself breaking if given a tag with an 'i' in it.
> But, for instance, there's also:
> fl_set_fonts_xft.cxx: if (strncasecmp(style, "Italic", 6) == 0)
> fl_set_fonts_xft.cxx: if (strncasecmp(style,
> "Oblique", 7) == 0)
> Fl_get_system_colors.cxx: if (scheme_ &&
> !strcasecmp(scheme_, "plastic")) {
> etc.
> (if they are called after the setlocale(), anyway)
> I imagine some of the uses of fl_tolower() and fl_toupper() might be
> a problem as well.
Yup, OK, I see where you are with this. Hmm...
Basically, if you set the locale to Turkish (or I suppose potentially
some other Turkic language, Crimea or whatever...) then any time we (in
the fltk core lib) try to string compare against a word that has a
"lower-case-small-i" in it, then the comparison will fail, since we
*expect* "i" to become "I" but with those locales selected it instead
gets promoted to a "upper-case-dotted-I" instead...
Well, that's a bit tricky.
Observations:
The use of strncasecmp() in fl_set_fonts_xft.cxx to extract face styles
is mostly my fault, and is really not very nice at all; there's (at
least) one STR open on it already describing cases where it fails on
some combination of host and fonts... We might be able to do something
more robust (though I don't quite know what.)
We could make it so that the scheme has to be explicitly lowercase
"plastic", thereby ducking that specific failure.
Other uses (e.g. in the file_chooser or pathname code, possibly even in
arg parsing...) we would probably *want* the locale-specific behaviour
though?
And yes, tolower and toupper might well be problematic in the same way.
I can't imagine we are the only people hitting this - do we have any
idea what other platforms do?
SELEX Galileo Ltd
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14
3EL
A company registered in England & Wales. Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk