From kde-core-devel Mon Sep 01 06:27:36 2008 From: Thiago Macieira Date: Mon, 01 Sep 2008 06:27:36 +0000 To: kde-core-devel Subject: Re: Encoding problem in the file ioslave Message-Id: <200809010827.44528.thiago () kde ! org> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=122025063320264 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--nextPart3312070.FKxBi6v8Vq" --nextPart3312070.FKxBi6v8Vq Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Michael Pyne wrote: >Well it would still be nice if people were able to open files that are > sitting there right on the disk. =A0Even after you extract the tar you > cannot navigate into the directory with Dolphin. =A0And the directory > really is there. You can't. QFile won't let you because there's no way you can represent a broken=20 encoding in QString. QDir and QDirIterator will also simply skip the file=20 as if it didn't exist. Be careful if you choose to change everything to QByteArray. The KIO=20 protocol is well established, so you can't change the meaning of anything=20 there. I would recommend instead to use the URL field, but be really=20 careful to use the encoded components of QUrl/KUrl: QUrl suffers from the=20 same problem of not being able to represent a random binary byte in a=20 QString, so it simply won't. And if you use QUrl or QByteArray, you'll have to completely bypass QFile=20 everywhere! I.e. you'll have to use the native 8-bit functions like=20 open(2) or fopen(3) and *never* QFile. Also remember that Windows (we seem to care about that platform now,=20 right?) uses Unicode to store filenames. If you convert from Unicode to=20 8-bit, make sure you're using UTF-8, not the local encoding for that=20 platform, or use URLs. So in the everywhere above where you converted=20 from QFile to the non-Win32 functions, be sure to use the local encoding=20 on Unix, but UTF-8 on Windows. =2D-=20 =A0 Thiago Macieira =A0- =A0thiago (AT) macieira.info - thiago (AT) kde.org =A0 =A0 PGP/GPG: 0x6EF45358; fingerprint: =A0 =A0 E067 918B B660 DBD1 105C =A0966C 33F5 F005 6EF4 5358 --nextPart3312070.FKxBi6v8Vq Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iD8DBQBIu4tZM/XwBW70U1gRAjqRAJ4n37BxF3xiYd/4ouNyLPPwjgRpxwCffyiE FST6wXhaeKVzeVKX2GP8xsI= =C0R1 -----END PGP SIGNATURE----- --nextPart3312070.FKxBi6v8Vq--