[PATCH] UTF-8 encoded tips files

Adriaan de Groot adridg at cs.kun.nl
Thu Apr 29 17:24:48 BST 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thursday 29 April 2004 18:12, Waldo Bastian wrote:
> On Thu April 29 2004 17:28, Adriaan de Groot wrote:
> > KOrganizer's tips file is UTF-8 encoded; it uses î to encode
> > the "registered trademark" symbol after the word Microsoft.
> > I suppose that's how it should be (UTF-8 encoding).
>
> You mean it contains two bytes equal to à and ® resp? It doesn't
> contain the string "î" I may hope?

Yes; I could hardly have phrased it _less_ clearly, could I. If I display the 
file in latin-1 I get ®, which maps to ® in utf-8.

>  QByteArray data = file.readAll();
>  QString content = QString::fromUtf8(data.data(), data.size());

Mm, yes, that covers the case where there are embedded NULs in the file as 
well (could that happen?). I'll go that route instead, and then look at if I 
can't change it to QByteArray manipulation for the searching for <html> tags, 
so that there's not so much translation back and forth between bytes and 
UTF-8 chars.

- -- 
pub  1024D/FEA2A3FE 2002-06-18 Adriaan de Groot <groot at kde.org>
                     Would you like a freem?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (FreeBSD)

iD8DBQFAkSxVdqzuAf6io/4RAtfKAJ4pJ2gNATpjBZH46Pks9Z8Qius37gCfc6EO
s1HUO8XlRPG+w6L1aZgAu+M=
=bOeZ
-----END PGP SIGNATURE-----




More information about the kde-core-devel mailing list