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

List:       kde-core-devel
Subject:    Re: [PATCH]: KNewsTicker querying non-ISO8859-1 sites
From:       Frerich Raabe <frerichraabe () gmx ! de>
Date:       2002-03-08 14:12:40
[Download RAW message or body]

On Friday 08 March 2002 13:45, Lars Knoll wrote:
> > Hi,
> >
> > the attached patch, courtesy of Volker Augustin
> > <volker.augustin@perfektionismus.de> apparently makes cyrillic characters
> > as well as german umlauts work in KNewsTicker. I hope it makes asian
> > charsets work as well, but I didn't yet find a suitable font.
> >
> > You can use the URLs http://www.slashdot.jp/slashdot.rdf (japanese),
> > http://www.hamovniki.net/~d00mer/lenta_rdf/lenta.rdf (russian) and
> > http://www.heise.de/newsticker/heise.rdf (german) to test. Just in case
> > somebody has one of those giant unicode fonts handy.
> >
> > Ok to commit?
>
> The patch is way to complicated and disregards that QXml can do the
> decoding work for you. QXml can autodetect the encoding, if you don't use
> the QDomDocument::setContent( Q(C)String ) method, but setContent(
> QByteArray ).
>
> Please try the one liner attached. Seems to work fine for me for the
> russian page.

Ah yes, that's much better. I didn't know about that trick, I attached a patch 
which adds a note about that to the QDomDocument documentation. Lukas, any 
chance whether you'd try Lars' patch on some sites not using ISO8859-1?

- Frerich

["qdom.diff" (text/x-diff)]

Index: qdom.cpp
===================================================================
RCS file: /home/kde/qt-copy/src/xml/qdom.cpp,v
retrieving revision 1.27
diff -u -3 -p -r1.27 qdom.cpp
--- qdom.cpp	2002/02/26 20:22:01	1.27
+++ qdom.cpp	2002/03/08 14:09:28
@@ -5994,7 +5994,9 @@ bool QDomDocument::setContent( const QSt
 }
 
 /*!  \overload
-  This function reads the XML document from the byte array \a buffer.
+  This function reads the XML document from the byte array \a buffer. Note that
+  this message makes QDomDocument autodetect the encoding of the given data
+  as well.
 */
 bool QDomDocument::setContent( const QByteArray& buffer, bool namespaceProcessing, \
QString *errorMsg, int *errorLine, int *errorColumn )  {



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

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