Solution and small question (was Re: [imp] Question about charset and Saved Mail)

Santiago Romero sromero at servicom2000.com
Wed Jan 15 14:42:21 PST 2003


En Wed, 15 Jan 2003 14:22:32 +0100 Jan Schneider <jan at horde.org>
escribio:

> > 1.- I also need to decode UTF8, and I have apache with xml
> > support, so I have the utf8_decode function available. How do I
> > identify WHEN my message is utf8-encoded? I mean,
> > 
> >  elseif( $structure->encoding == WHAT_DO_I_PUT_HERE_FOR_UTF8 )
> >    $msg = utf8_decode($msg);
> > 
> >  How do I detect if my message is UTF8 encoded?
> 
> The encoding in this part of the code is the Transfer-Encoding that
> defines how the message is encoded to only contain 7bit characters.
> 
> UTF-8 refers to the messages Content-Encoding that defines the charset
> the message is written in. These two have nothing to do with each
> other.

 If I comment the elseif in the above source code the message is
displayed (and also openned in the compose window) correctly. All
UTF8 body-encoded messages are displayed correctly but all non utf8
not, of course (without the elseif all are decoded, including those
who doesn't need to be decoded).

 Which condition should I put in the elseif() to apply utf8_decode
just to messages that are utf8 encoded?

> > 2.- Do you think the above source code is well applied, or it
> > could damage attachs or something like that? I hope $msg is just
> > the body message, not the message itself. If it's the body message
> > I think the code is right, if it's the msg + attachments, I'm
> > afraid the qprint() or base64() functions could modify the attachs
> > or something they shouldn't touch.
> 
> Not sure about this one.

 I'll make a test battery in any case :)

 Thanks a lot for your help in all this thread.

-- 
Santiago Romero


More information about the imp mailing list