[PATCH] UTF-8 encoded tips files

Waldo Bastian bastian at kde.org
Thu Apr 29 17:44:30 BST 2004


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

On Thu April 29 2004 18:24, Adriaan de Groot wrote:
> 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?). 

It's more the fact that the QByteArray may be missing a null-termination 
completely. In which case content would have trailing garbage and/or causes a 
memory access violation.

Cheers,
Waldo
- -- 
bastian at kde.org  |   SUSE Linux 9.1 Order Now!   |  bastian at suse.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQFAkTDuN4pvrENfboIRAr+KAJ9jJ4KVpoEahsj/co18+njNzHnQGwCfUon7
jaq0Nnyr6z8s6sRUV3W0QsI=
=Kt5B
-----END PGP SIGNATURE-----




More information about the kde-core-devel mailing list