[Qt-interest] argv & utf-8 code

1+1=2 dbzhang800 at gmail.com
Sun Aug 1 04:03:09 CEST 2010


w.readFileToBuffer(QString(*(++argv)));

if your are sure that *(++argv) is an utf-8 encoded string,

your should use:
w.readFileToBuffer(QString::fromUtf8(*(++argv)));

or your can use:
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
w.readFileToBuffer(QString(*(++argv)));

read QString Class Reference to get more infomation.

Debao

On Sun, Aug 1, 2010 at 9:25 AM, Aaron Lewis <aaron.lewis1989 at gmail.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 07/31/2010 11:16 PM, 1+1=2 wrote:
>>> Handler always fire if UTF-8 string appears , it will fail to open ,
>>
>> how do you assign the utf-8 string to the QString fName ?
>
> I don't know how KDE do it , just put it as a Service Menu ..
>
> - --
> Best Regards,
> Aaron Lewis - PGP: 0x4A6D32A0
> FingerPrint EA63 26B2 6C52 72EA A4A5 EB6B BDFE 35B0 4A6D 32A0
> irc: A4R0NL3WI5 on freenode
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.16 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAkxUzRkACgkQvf41sEptMqDwswCgi9Sw2iQaJEa5wajl2aLyoYbz
> /TsAoKejshsEafPpp1EbFWSMkkn36Jol
> =PDZo
> -----END PGP SIGNATURE-----
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>



More information about the Qt-interest-old mailing list