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

List:       kopete-devel
Subject:    Re: [Kopete-devel] [Bug 72917] UTF8 and other cause XML parsing
From:       Thiago Macieira <thiago.macieira () kdemail ! net>
Date:       2004-01-23 20:49:03
Message-ID: 200401231849.03909.thiago.macieira () kdemail ! net
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


Jason Keirstead wrote:
>The point of this code block is not to determine if a string is UTF..
> we pretty much *know* it isn't. It's purpose is to take a non-UTF
> string for which the codec is totally unknown and make it displayable
> as UTF, by replacing undecodable characters with ?

All the QTextCodec decoders do that, except for the UTF-8 one. That's 
the only reason why we have to special-case UTF-8 (because Qt 
special-cases it too).

>I had assumed that QChar took care of the doubel byte stuff for me.

QChar does. But your code reads one 'char' at a time. And it uses a 
variable 'utf' you defined nowhere, so I can't really tell what you 
wanted.

>> - if it isn't given, try to the user's locale codec. If that fails,
>> try
>
>Why bother with the locale codec? What does my locale have to do with
> the sender's?

Because there's a high probability that the person you're talking to is 
talking the same language as you speak. Therefore, it's quite possible 
the encoding is the same.

Think of text-mode IRC clients, for instance.

>UTF-8 should be last, because latin1 will indicate failure if it's not
> latin1. UTF is the only codec in QT that *always* decodes. So we
> shoudl try that last, then clean it up.

No, most codecs can decode safely most strings. All the ISO-8859 codecs 
do so, at least. That's not because the codec is broken: it's just 
because any 8-bit string is valid ISO-8859-X (except for NULs).

So, fromLatin1 will never fail. Again, note "will never fail" is not the 
same as "does not report failure".
-- 
  Thiago Macieira  -  Registered Linux user #65028
   thiagom (AT) mail (dot) com
    ICQ UIN: 1967141   PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

[Attachment #5 (application/pgp-signature)]

_______________________________________________
Kopete-devel mailing list
Kopete-devel@kde.org
https://mail.kde.org/mailman/listinfo/kopete-devel


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

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