[Qt-interest] argv & utf-8 code
Aaron Lewis
aaron.lewis1989 at gmail.com
Sat Jul 31 16:55:16 CEST 2010
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
In main() , i've got a simple class w , which has a function
readFileToBuffer(QString fName).
Well it's like this:
In main():
if(argc > 2){
w.readFileToBuffer(QString(*(++argv)));
}
And in class codecs:
void codecs::readFileToBuffer(QString fileName)
{
QFile file(fileName);
if (!file.open(QFile::ReadOnly)) {
// Hanlder, Popup a message , telling file can't be opened
}
}
Handler always fire if UTF-8 string appears , it will fail to open ,
it's problems with non-ascii strings , anyone could help ?
I'm testing with KDE service menu , only successes when absolute path is
totally ascii codes.
Many thanks !
- --
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/
iEYEARECAAYFAkxUOVQACgkQvf41sEptMqBKyQCfXiaPcEmHBGnHuO2+3SLEsewU
VM0AnizOzo5QlndXHnol0fngu7VARvul
=0BSR
-----END PGP SIGNATURE-----
More information about the Qt-interest-old
mailing list