[Patch] Use XAP_App::getDefaultEncoding in xap_Strings.cpp [Was Commit: fix caller of wctomb instead]

From: Anthony Fok (anthony@thizlinux.com)
Date: Sun Mar 02 2003 - 13:15:35 EST

  • Next message: Dom Lachowicz: "Re: [Patch] Use XAP_App::getDefaultEncoding in xap_Strings.cpp [Was Commit: fix caller of wctomb instead]"

    Dear all,

    As mentioned in my previous post, AbiWord 1.1.x (GTK2 on GNU/Linux)
    would fail to display the text in some dialog boxes when started under
    a non-UTF8 locale (say zh_TW.Big5, zh_CN.GB2312). All is normal in
    zh_TW.UTF-8 locale.

    I was perplexed as to why some Chinese strings display properly, and some
    don't, with the error:

            WARNING **: Invalid UTF8 string passed to pango_layout_set_text()

    After some investigation, it turns out to be a difference in the call to
    wctomb_conv() between XAP_DiskStringSet::setValue() and
    AP_DiskStringSet::setValue().

      Tomas Frydrych's commit to xap_Strings.cpp in January 2002 (to fix Bug 2570):

        http://www.abisource.com/bonsai/cvsview2.cgi?diff_mode=context&whitespace_mode=show&root=/cvsroot&subdir=abi/src/af/xap/xp&command=DIFF_FRAMESET&file=xap_Strings.cpp&rev2=1.23&rev1=1.22

      Christian Biesel's commit to ap_Strings.cpp in October 2002

        http://www.abisource.com/bonsai/cvsview2.cgi?diff_mode=context&whitespace_mode=show&root=/cvsroot&subdir=abi/src/wp/ap/xp&command=DIFF_FRAMESET&file=ap_Strings.cpp&rev2=1.14&rev1=1.13

    So, XAP_DiskStringSet::setValue() was storing the strings in the current
    system encoding, e.g. when LANG=zh_TW.Big5, it stores the strings in Big5
    encoding; whereas AP_DiskStringSet::setValue() does the right thing by
    storing the text in UTF-8 encoding. (Or something like that; I don't fully
    understand the details.)

    So, I changed xap_Strings.cpp to use the line in ap_Strings.cpp, and
    voila, it works! :-) Patch is attached. I hope the change won't break
    things on other platforms.

    Cheers,

    Anthony

    -- 
    Anthony Fok Tung-Ling
    ThizLinux Laboratory   <anthony@thizlinux.com> http://www.thizlinux.com/
    Debian Chinese Project <foka@debian.org>       http://www.debian.org/intl/zh/
    Come visit Our Lady of Victory Camp!           http://www.olvc.ab.ca/
    




    This archive was generated by hypermail 2.1.4 : Sun Mar 02 2003 - 13:18:15 EST