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

List:       kde-commits
Subject:    Re: kdepim/kmail
From:       Lukáš Tinkl <lukas.tinkl () suse ! cz>
Date:       2003-01-19 11:38:31
[Download RAW message or body]

Dne ne 19. ledna 2003 11:40 Bo Thorsen napsal(a):
> CVS commit by thorsen:
>
> New convenience method bodyToUnicode that returns a unicode QString with
> the message body.
>
>
>   M +12 -0     kmmsgpart.cpp   1.96
>   M +5 -0      kmmsgpart.h   1.33
>
>
> --- kdepim/kmail/kmmsgpart.cpp  #1.95:1.96
> @@ -69,4 +69,16 @@ void KMMessagePart::setBodyFromUnicode(
>  }
>
> +QString KMMessagePart::bodyToUnicode(const QTextCodec* codec) const {
> +  if (codec == 0)
> +    // No codec was given, so try the charset in the mail
> +    codec = KMMessage::codecForName( charset() );
> +  if (codec == 0)
> +    // That also didn't work, so try a default one.
> +    codec = QTextCodec::codecForName("iso-8859-1");
> +  assert( codec );
> +
> +  return codec->toUnicode( bodyDecoded() );
> +}

Please don't assume iso-8859-1==default, it won't work for most languages. I'd 
suggest using something like QTextCodec::codecForLocale() instead

-- 
Lukáš Tinkl
KDE developer
---------------------------------------------------------------------
SuSE CR, s.r.o.  e-mail: lukas.tinkl@suse.cz, lukas@kde.org
Drahobejlova 27  tel: +420 2 9654 2373
190 00 Praha 9   fax: +420 2 9654 2374
Czech Republic   http://www.suse.cz/
[prev in list] [next in list] [prev in thread] [next in thread] 

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