Getting the document from the cache
David Faure
faure at kde.org
Sun Jan 30 22:48:58 GMT 2005
On Sunday 30 January 2005 22:39, Andras Mantia wrote:
> David Faure wrote:
>
> > Why does the method return a QString anyway?
>
> Because we were talking about a method returning the source as a string
> (John even mentioned QString) and because it looks more user friendly to
> the (end) user.
Sure. My issue was: we don't know the encoding, which is needed to convert
to a QString. But well, KHTML probably knows it, somewhere and somehow.
I just don't know that part of the code well enough to know where.
> A QTextStream::setEncoding(QTextStream::UnicodeUTF8) is
> missing after QTextStream stream( &f ), though. This combination seems to
> work, at least since I started to use for text stream, I didn't get any new
> complain about Quanta messing up the documents written in non-English.
I can't see how it would work with e.g. russian or chinese web pages. The source
is certainly not in UTF-8. Heck, most french pages aren't either :)
> QByteArray KHTMLPart::documentSource() const
That version looks much safer encoding-wise, but you're right that the caller
of the method won't know what to do with it...
I guess "view document source" works because kate autodetects the encoding?
--
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
More information about the kfm-devel
mailing list