Maik Schmidt <mschmidt / atxeu.com> wrote:
> When I download mails containing non-ASCII 
> characters in the subject or the body, they are encoded using the 
> q-encoded quoted-printable encoding scheme. How can I convert them to 
> normal String objects? unpack("M*") does not seem to support q-encoding.


def decodeqp(str)
  str.gsub(/=\?(.+?)?\?([bq])\?(.+?)\?=/i) { |x|
    m = $~
    case m[2].downcase                           # m[2] is type of encoding
      when "b" then s=m[3].unpack("m*").to_s     # m[3] is encoded string
      when "q" then s=m[3].unpack("M*").to_s
    end
    case m[1].downcase                           # m[1] is charset
      when "iso-8859-1"
        ...
      when "iso-8859-2"
        ....


you might use iconv for charset conversion then


HTH (although I was demonstrated yesterday again I'm still Ruby novice)
Martin