qt-interest@trolltech.com
[Top] [All Lists]

Re: The application caption cannot display Chinese

Subject: Re: The application caption cannot display Chinese
From: "Volker Hilsheimer"
Date: Wed, 13 Oct 2004 17:54:26 +0200
"wang.xc" <njuwang03g@xxxxxxxxxxxxxxxxxxx> wrote in message
news:200410130558.i9D5wCdE028160@xxxxxxxxxxxxxxxxxxxxxx
> text= "some chinese words"
>
> In Aix OS:
>      setCaption(text);
> //is ok
>
> In Hp Tru64 OS:
> QTextCodec *codec = QTextCodec::codecForName("GBK");
>     setCaption(codec->toUnicode(text));
>     //is ok,too
>
> In Sun OS:
> //how to do ?
>
> and any other method to slove this probelm? I want to unify this
program.
>
> thank you !
>
>          wangxc,PRC

I don't quite understand - QWidget::setCaption() takes a QString which
contains Unicode. You can provide unicode either directly, or through a
text codec that decodes your 8bit data as in your HP case. If "text" is
GBK-encoded 8bit data then just calling setCaption(text) won't work,
unless your codec for C strings is GBK for some reason.

Volker

--
List archive and information: http://lists.trolltech.com/qt-interest/

<Prev in Thread] Current Thread [Next in Thread>