sumirmehta has asked for the wisdom of the Perl Monks concerning the following question:

Hi all, I am trying to send some non-ascii , unicode characters (something like ḐḠḰṀṐ) via lotus notes to a mail server, and then reading the same using Mail imap module. the message has foll attributes when read from mail server - Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: base64 The problem is while decoding the message text the charcters appear garbled. I tried decoding the characters to utf8 (decode("utf8",$line) but to no help. Could you please suggest some way to display /print these characters ?
  • Comment on IMAP mail decoding - non ascii characters

Replies are listed 'Best First'.
Re: IMAP mail decoding - non ascii characters
by ikegami (Patriarch) on Oct 27, 2008 at 19:46 UTC

    How do you view the characters? How do you encode them first?

    Update:

    If you're just printing to STDOUT, you might simply need

    use open ':std', ':locale';
      The Lotus Notes app encodes the message using base-64 content type encoding, and so while decoding i'm using the same (MIME-Base64-3.07 > MIME::Base64). The thing is this function/moudule decodes it back from base-64 to ascii character set (not mentioned clearly in the doc as to what it converts to), and hence the problem.

        You answered how Lotus Notes encodes (UTF-8, Base64).
        You answered how you decode (Base64, UTF-8).
        But my question was how do you encode what you decoded.

        decode produces strings, an opaque type. You can't output decoded strings. Only bytes can be outputted to a system file handle.

        I also asked how do you view the characters. On the console? As a web page cause you're writing a CGI app?