From kde-core-devel Fri Mar 08 14:12:40 2002 From: Frerich Raabe Date: Fri, 08 Mar 2002 14:12:40 +0000 To: kde-core-devel Subject: Re: [PATCH]: KNewsTicker querying non-ISO8859-1 sites X-MARC-Message: https://marc.info/?l=kde-core-devel&m=101559676031626 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--------------Boundary-00=_Z0MP4YLI15KCQIGIBR78" --------------Boundary-00=_Z0MP4YLI15KCQIGIBR78 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit On Friday 08 March 2002 13:45, Lars Knoll wrote: > > Hi, > > > > the attached patch, courtesy of Volker Augustin > > 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 --------------Boundary-00=_Z0MP4YLI15KCQIGIBR78 Content-Type: text/x-diff; charset="iso-8859-1"; name="qdom.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="qdom.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 ) { --------------Boundary-00=_Z0MP4YLI15KCQIGIBR78--