Re: MIME::QuotedPrint - extra '=' and linebreak?



Jenda Krynicky wrote:
Gunnar Hjalmarsson <noreply@xxxxxxxxx> wrote:
op wrote:
when it comes to character encodings I decided to let myself off
the hook and use a module, namely MIME::QuotedPrint.
<snip>

However, the module didn't quite produce the result I expected. It
correctly encoded the non-ASCII characters to '=<1byte_hexcode>', but
unexpectedly also added an extra '=\n' sequence to the end of the
string I was encoding.
Not quite. Without further arguments to encode_qp() it splits up long lines with "=\n" in between. I haven't noticed any "=\n" at the end of the encoded string, though.

You said that yourself ... without further arguments ...

I have made a similar experience, and my "hack" is even more complicated:

$encoded = join "\n ",
map { tr/ /_/; "=?ISO-8859-15?Q?$_?=" }
split /\s*=\n\s*/, $encoded;

When sending a long subject header via a sendmail pipe, that code makes at least my email client (Thunderbird) happy...

so I do not understand why don't you use

"=?ISO-8859-15?Q?" . encode_qp($raw_data, "") . "?=";

Actually I have done that, too. But I fear that very long subject lines might mess up the message, so making use of the "=\n" that MIME::QuotedPrint generates seems like a good idea.

Maybe I'm wrong...

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
.



Relevant Pages

  • Re: eval and unicode
    ... encoding your terminal/file/whatnot is written in. ... you have a byte string that starts with u, then ", then something ... The first item in the sequence is \u5fb9 -- a unicode code point. ...
    (comp.lang.python)
  • Whats This Coding Method?
    ... While playing around with ideas for entropy coding in lossy image compression stuff, I tried out an idea based on the Haar transform (but for encoding sequences of bits, not for use in the traditional transform stage so often found in lossy image compression schemes). ... Imagine you have a string of bits, such as "0010011110000101011...", of finite length. ... We do that for the whole string of pairs, so as to get a string of sums and a string of corresponding differences. ... So, we end up with a sequence of sums, and an encoded sequence of differences, consisting of only bits representing the signs of nonzero differences. ...
    (comp.compression)
  • Re: just a bug
    ... The contents of an XML document is a sequence of unicode code points, ... encoded into a sequence of bytes using some character encoding. ... but your string is not a legible utf-8 string. ...
    (comp.lang.python)
  • Re: how to convert string to binary and back in Ruby 1.9?
    ... OK, so String#force_encoding just changes the encoding, but does not ... alter the string. ... sequence of Cyrillic characters, when it thinks its encoding is ... Is ruby storing the ISO-8859-1 encoded string as a sequence ...
    (comp.lang.ruby)
  • Re: Using ShellExec to Invoke an Outgoing E-Mail Message
    ... protocol is a clean and simple way of launching the ... email client rather than sending unconditionally, ... strEMails = strEMails & txtEmailExtraUsers ... Public Function blnOpenEMail(ByVal strEmailAddress As String, ...
    (microsoft.public.vb.winapi)