RE: Handling Charset

2002-05-02 Thread gross, cedric



> -Message d'origine-
> De : Bob Showalter [mailto:[EMAIL PROTECTED]]
> Envoyé : jeudi 2 mai 2002 17:44
> À : gross, cedric; Beginners (E-mail)
> Objet : RE: Handling Charset
> 
> 
> > -Original Message-
> > From: gross, cedric [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, May 02, 2002 11:27 AM
> > To: Beginners (E-mail)
> > Subject: Handling Charset
> > 
> > 
> > Hello,
> > 
> > How to handle this kind of string :  =?iso-8859-1?Q? Is 
> > there a perl
> > module to manage  that ?
> 
> Your question is too vague. What exactly to you mean by "handle
> this kind of string?".

I mean : When, in a file or a mail, I have a string like
'=?iso-8859-1?Q?blalblalblal?='
how to tell Perl to take into account the charset information and not
using directly the string like above ?

> 
> If you want to know about how Perl works with the locale system,
> see:
> 
>perldoc perllocale
> 

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Handling Charset

2002-05-02 Thread Kevin Meltzer

I rolled my own module to handle i18n issues with email, and parsing
strings such as that. One of the MIME::* or Mail::* modules may do it,
but I didn't see any which did it (which is why I did  my own).

Basically, you need to parse out the bits of the string (not hard)..
then take the encoded part, either base64 or quote-print decode it (the
B or Q), then convert the charset to what you want (I used Text::Iconv
to go from charset to charset). 

You will have to loop through the string, since it may contain various
encodings. Something like:

while ($string =~ s!(.*?)=\?(.+?)\?(.)\?(.*?)\?=(.*?)!!is) { .. parsing
and decoding .. }

I use MIME::Base64 and MIME::QuotedPrint for the decoding. Anyways,
that should get you started. You may also want to ask on the perl-i18n
list for these types of things, you can also email me directly since
this isn't really a beginners question (unless you ONLY want to parse
the string) and I have a lot of experience with this.

Cheers,
Kevin

On Thu, May 02, 2002 at 05:27:03PM +0200, gross, cedric ([EMAIL PROTECTED]) said 
something similar to:
> Hello,
> 
> How to handle this kind of string :  =?iso-8859-1?Q? Is there a perl
> module to manage  that ?
> 
> Thanks for your answer.
> 

-- 
[Writing CGI Applications with Perl - http://perlcgi-book.com]
I went to a general store.  They wouldn't let me buy anything
specifically.
-- Steven Wright

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Handling Charset

2002-05-02 Thread Bob Showalter

> -Original Message-
> From: gross, cedric [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 02, 2002 11:27 AM
> To: Beginners (E-mail)
> Subject: Handling Charset
> 
> 
> Hello,
> 
> How to handle this kind of string :  =?iso-8859-1?Q? Is 
> there a perl
> module to manage  that ?

Your question is too vague. What exactly to you mean by "handle
this kind of string?".

If you want to know about how Perl works with the locale system,
see:

   perldoc perllocale

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]