[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Seeing Korean character
From:       Warwick Allison <warwick () troll ! no>
Date:       1999-04-29 10:58:05
[Download RAW message or body]

On Thu, 29 Apr 1999, you wrote:

>It is problem that QString can't convert CJK(Chinese, Japanese, Korean)
>encoding into unicode correctly. ...
>For testing purpose, I modified the kdelibs/kdecore/kapp.cpp and
>kdelibs/kdecore/klocale.cpp to use codec related functions. (I
>inserted setDefaultCodec() in KApplication::init() and modified
>KLocale::translate() to use codec->toUnicode().

The setDefaultCodec() should not be needed - the codec should do all you need,
and only when you need it.  The codec to use in a codec->toUnicode() is the
QTextCodec::codecForLocale(), or better, use the encoding named in the .mo file
to choose a codec.

>I attached the modified 
>klocale.cpp and kapp.cpp) and I used a kedit's translated message 
>file(kedit.mo). then I got a screen that Korean characters are appeared 
>in menu well. 

I'm not completely familiar with KDE's i18n, but this looks not-quite-right:

    // to convert CJK encoding to unicode
    // return text;
    return kapp->translate("KLocale", text);

Should be:

    return codec->toUnicode(text);

Where "codec" is set to codecForName(charset_of_mo_file) in the KLocale
constructor.

> but I can't see Korean characters in file selection dialog 
>because it doesn't use i18n().  If I change QString, It may work fine.

QFileDialog calls QApplication::translate().  But perhaps you refer to the KDE
file dialog.


Don't change QString or use setDefaultCodec().  That is DEFINITELY the wrong
approach for internationalized software.  All sorts of other thing will break
if QString does conversions - eg. kmail uses QString to store attachments
(wrong - it should use QByteArray - but it does).  Leave conversions at the
point where the user-directed text is, as you have, in KLocale.

>here's kedit screenshot that is displaying Korean characters.
><http://www.mizi.co.kr/~louis/temp/kedit.jpg>

Most cool.  Is hanIM working well for entering Korean text into the Qt widgets
(eg. QLineEdit, QMultiLineEdit)? For non-Qt widgets, just be sure they use
QKeyEvent::text() rather than QKeyEvent::ascii() when they are inserting text.

>and I wonder if there is a team for CJK support or i18n.

I know of kde-jp@albert.nikkeibp.co.jp; I guess any group NOT using Latin-1
(eg. using Cyrillic) would also be interested in getting the Unicode support in
KDE right.

And I'm always interested - best to mail me directly when threads like this
start on kde-devel - though Matthias notices some threads and yells to me.

--
Warwick

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic