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

List:       kde-core-devel
Subject:    Re: Encoding problem in the file ioslave
From:       Thiago Macieira <thiago () kde ! org>
Date:       2008-09-01 6:27:36
Message-ID: 200809010827.44528.thiago () kde ! org
[Download RAW message or body]


Michael Pyne wrote:
>Well it would still be nice if people were able to open files that are
> sitting there right on the disk.  Even after you extract the tar you
> cannot navigate into the directory with Dolphin.  And the directory
> really is there.

You can't.

QFile won't let you because there's no way you can represent a broken 
encoding in QString. QDir and QDirIterator will also simply skip the file 
as if it didn't exist.

Be careful if you choose to change everything to QByteArray. The KIO 
protocol is well established, so you can't change the meaning of anything 
there. I would recommend instead to use the URL field, but be really 
careful to use the encoded components of QUrl/KUrl: QUrl suffers from the 
same problem of not being able to represent a random binary byte in a 
QString, so it simply won't.

And if you use QUrl or QByteArray, you'll have to completely bypass QFile 
everywhere! I.e. you'll have to use the native 8-bit functions like 
open(2) or fopen(3) and *never* QFile.

Also remember that Windows (we seem to care about that platform now, 
right?) uses Unicode to store filenames. If you convert from Unicode to 
8-bit, make sure you're using UTF-8, not the local encoding for that 
platform, or use URLs. So in the everywhere above where you converted 
from QFile to the non-Win32 functions, be sure to use the local encoding 
on Unix, but UTF-8 on Windows.

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

["signature.asc" (application/pgp-signature)]

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

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