? charset.patch Index: ChangeLog =================================================================== RCS file: /home/cvs/fvwm/fvwm/ChangeLog,v retrieving revision 1.3022 retrieving revision 1.3023 diff -u -u -r1.3022 -r1.3023 --- ChangeLog 9 Jan 2008 10:36:04 -0000 1.3022 +++ ChangeLog 26 Jan 2008 07:28:32 -0000 1.3023 @@ -1,3 +1,10 @@ +2008-01-26 Olivier + + * libs/FlocaleCharset.c: (FlocaleInit_X_Charset), + (FlocaleCharsetInit), (FlocaleCharsetGetDefaultCharset): + * NEWS: + Fixed the determination of the X charset on UTF-8 system + 2008-01-09 Dominik Vogt * fvwm/placement.c (__pl_minoverlap_get_next_x): Index: NEWS =================================================================== RCS file: /home/cvs/fvwm/fvwm/NEWS,v retrieving revision 1.739 retrieving revision 1.740 diff -u -u -r1.739 -r1.740 --- NEWS 22 Jan 2008 00:12:07 -0000 1.739 +++ NEWS 26 Jan 2008 07:28:32 -0000 1.740 @@ -16,6 +16,7 @@ - Fixed a memory leak in internationalized font handling. - Fixed a bug in MinOverlap placement. - Fixed the StickyAcrossPages style in the FvwmPager. + - Fixed the determination of the X charset on UTF-8 system ------------------------------------------------------------------- Index: libs/FlocaleCharset.c =================================================================== RCS file: /home/cvs/fvwm/fvwm/libs/FlocaleCharset.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -u -r1.28 -r1.29 --- libs/FlocaleCharset.c 9 Jan 2008 10:21:37 -0000 1.28 +++ libs/FlocaleCharset.c 26 Jan 2008 07:28:32 -0000 1.29 @@ -525,7 +525,53 @@ } if (FLCXOMCharsetList_num > 0 && FLCXOMCharsetList[0]) { + char *best_charset; + + if (FLCLocaleCharset != NULL) + { + best_charset = FLCLocaleCharset->x; +#if FLOCALE_DEBUG_CHARSET + fprintf(stderr, + "[FlocaleInitCharset] FLCLocaleCharset: %s\n", + best_charset); +#endif + } + else + { + best_charset = FLOCALE_FALLBACK_XCHARSET; +#if FLOCALE_DEBUG_CHARSET + fprintf(stderr, + "[FlocaleInitCharset] FALLBACK: %s\n", + best_charset); +#endif + } + FLCXOMCharset = FLCXOMCharsetList[0]; + if (best_charset == NULL) + { + /* should not happen */ + } + else + { + for(i = 0; i < FLCXOMCharsetList_num; i++) + { + if (StrEquals( + best_charset, + FLC_DEBUG_GET_X_CHARSET( + FLCXOMCharsetList[i]))) + { + FLCXOMCharset = FLCXOMCharsetList[i]; + break; + } + } + } +#if FLOCALE_DEBUG_CHARSET + fprintf(stderr, + "[FlocaleInitCharset] XOM charset " + "%i: %s\n", + i, + FLC_DEBUG_GET_X_CHARSET(FLCXOMCharset)); +#endif } #endif } @@ -542,24 +588,47 @@ return; } initialized = True; - /* set the defaults X locale charsets */ - FlocaleInit_X_Charset(dpy, module); + /* try to find the regular charset */ charset = getenv("CHARSET"); +#if FLOCALE_DEBUG_CHARSET + fprintf(stderr, + "[FlocaleInitCharset] CHARSET: %s\n", (!charset)? "null":charset); +#endif if ((!charset || strlen(charset) < 3) && FlocaleLibcharsetSupport) { charset = (char *)Flocale_charset(); +#if FLOCALE_DEBUG_CHARSET + fprintf( + stderr, + "[FlocaleInitCharset] FlocaleLibcharsetSupport: %s\n", + (!charset)? "null":charset); +#endif } if ((!charset || strlen(charset) < 3) && FlocaleCodesetSupport) { charset = Fnl_langinfo(FCODESET); +#if FLOCALE_DEBUG_CHARSET + fprintf( + stderr, + "[FlocaleInitCharset] Fnl_langinfo: %s\n", + (!charset)? "null":charset); +#endif } if (charset != NULL && strlen(charset) > 2) { FLCLocaleCharset = FlocaleCharsetOfLocaleCharset(charset); +#if FLOCALE_DEBUG_CHARSET + fprintf( + stderr, + "[FlocaleInitCharset] FLCLocaleCharset: %s\n", charset); +#endif } + /* set the defaults X locale charsets */ + FlocaleInit_X_Charset(dpy, module); + /* never null */ FLCUtf8Charset = FlocaleCharsetOfXCharset(FLOCALE_UTF8_XCHARSET); @@ -762,11 +831,11 @@ (module != NULL)? module:"FVWMlibs", "FlocaleGetDefaultCharset"); fprintf(stderr,"X Ouput Method "); - fprintf(stderr,"CHARSET env variable "); + fprintf(stderr,", CHARSET env variable"); if (FlocaleLibcharsetSupport) - fprintf(stderr,"locale_charset"); + fprintf(stderr,", locale_charset"); if (FlocaleCodesetSupport) - fprintf(stderr," nl_langinfo"); + fprintf(stderr,", nl_langinfo"); fprintf(stderr,"\n"); /* never null */ FLCLocaleCharset =