Re: Encoding issues

From: Jordi Mas (jmas@softcatala.org)
Date: Sat Nov 02 2002 - 11:20:53 EST

  • Next message: Christian Biesinger: "Re: Encoding issues"

    En/na Christian Biesinger ha escrit:
    > Hi,
    > so you may remember that some time ago, I checked in a patch to change the
    > encoding that AP_DiskStringSet uses to whatever
    > XAP_App::getDefaultEncoding uses (or something like that, can't remember
    > what exactly I did :) ).
    >
    > Anyway, it looks like this broke non-US-ASCII characters in the statusbar,
    > because of this piece of code in ap_StatusBar.cpp, line 493, in
    > AP_StatusBar::setStatusMessage(const char * pBuf, int redraw)
    > UT_UCS4_strcpy_char(bufUCS,pBuf);
    >
    > That function just uses the encoding that the default constructor of mbtowc
    > thinks is good as the source encoding. That seems to be ISO-8859-1 for me.
    > However, due to the patch I mentioned above, that string is already in
    > UTF-8.
    > This means that the statusbar will not display special characters (like,
    > but not limited to, german umlauts) correctly. Instead, it will show
    > characters looking like undecoded UTF-8 (like Ì)
    >
    > So... the question is:
    > What's the best way for fixing this?
    > Should UT_UCS4_strcpy_char take an additional (maybe optional) argument,
    > specifying the charset to convert from? AP_StatusBar would pass the result
    > of XAP_App::getDefaultEncoding to it, and this would work...

    Well,

    I did very recently the win32 status bar native implementation. Under win32
    this is displayed correctly because I added this piece of code on
    ap_Win32StatusBar.cpp to convert from UTF8 to the native encoding:

    ;-------------------------
    char *pText = UT_convert (utf8.utf8_str(),
                            utf8.byteLength(),
                            "utf-8",
                            XAP_EncodingManager::get_instance()->getNative8BitEncodingName(),
                            &uRead, &uWrite);

    ;-------------------------

    I saw that in Unix there was no conversion and the string was sent in UTF8
    format directly to the GTK widget. If GTK does not process UTF8 directly, then
    the UTF8->Native conversion may be can be done at XP level.

    Well, I hope this brings some light.

    Jordi,

    -- 
    

    Jordi Mas http://www.softcatala.org



    This archive was generated by hypermail 2.1.4 : Sat Nov 02 2002 - 11:30:18 EST