diff -rNu fluxbox-0.9.10/src/FbTk/XmbFontImp.cc fluxbox-0.9.10-utf8-fix/src/FbTk/XmbFontImp.cc --- fluxbox-0.9.10/src/FbTk/XmbFontImp.cc 2004-09-28 10:18:00.000000000 +0300 +++ fluxbox-0.9.10-utf8-fix/src/FbTk/XmbFontImp.cc 2004-09-29 15:47:00.141972304 +0300 @@ -136,11 +136,27 @@ int nmissing, pixel_size = 0, buf_size = 0; char weight[FONT_ELEMENT_SIZE], slant[FONT_ELEMENT_SIZE]; char * orig_locale = ""; + char orig_storage[128] = { 0 }; #ifdef HAVE_SETLOCALE if (utf8mode) { orig_locale = setlocale(LC_CTYPE, NULL); setlocale(LC_CTYPE, "UTF-8"); + memcpy(orig_storage, orig_locale, + strlen(orig_locale) > 127 ? 127 : strlen(orig_locale)); + orig_locale = orig_storage; + /* + * man setlocale says, that returned string + * is pointer to a static storage. So --- simply keep a copy + * of original string between further calls to setlocale. + * + * It appears, that area, being pointed to by orig_locale (got + * from 1st call to setlocale) is changed after subsequent call, + * thus string in orig_locale is invalid, causing + * setlocale(LC_CTYPE, orig_locale) + * to fallback to "C" locale. And this causes invalid FontSet to + * be returned => wrong window titles ;) + */ } #endif // HAVE_SETLOCALE fs = XCreateFontSet(display,