[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-bugs-dist
Subject: [Bug 72917] UTF8 and other cause XML parsing errors,
From: Jason Keirstead <jason () keirstead ! org>
Date: 2004-01-23 16:18:54
Message-ID: 20040123161854.20102.qmail () ktown ! kde ! org
[Download RAW message or body]
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
http://bugs.kde.org/show_bug.cgi?id=72917
------- Additional Comments From jason@keirstead.org 2004-01-23 17:18 -------
Martijn, and others, I have an idea how we can display thes emessages better.
Since these errors are infrequent, a little inefficientcy on them is OK. So, what we \
could do is this... when the XML parsing fails, we throw the string through this \
jobbie, that takes the string we *thought* was as UTF-8 and *makes sure* it is UTF-8:
QCString decodeAttempt( QCString &utf )
{
QTextCodec *utfCodec = QTextCodec::codecForName( "utf8" );
QString resultString;
for( uint i = 0; i < utf.length(); i++ )
{
QChar thisChar = utf[i];
if( utfCodec->canDecode( thisChar )
resultString += thisChar;
else
resultString += QChar('?');
}
return resultString.utf8();
}
.. Thus replacing all the un-encodable characters with ?
Then instead of
An internal Kopete error occurred while parsing a message:
XML document could not be parsed!
We can display:
WARNING: Kopete could not properly determine the encoding of the following message:
Foobar message ?? foo.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic