0

i try to import some files from IMAP Server, but i run into the following problem when trying to get the attachment names or subject that contain characters like 'Ö,Ä,Ü ß' etc....

How can i convert a string like this in the original value, which in this case, would be

BE-Berlin_(Charlottenburg)_HRB_35+Aktueller_Abdruck-20190920095708_pdf eingefügt am 20_09_19 09_59

?

This is the object i get when parsing the email

#<struct Net::IMAP::BodyTypeBasic
         media_type="APPLICATION",
         subtype="PDF",
         param=
          {"NAME"=>
            "=?utf-8?Q?BE-Berlin=5F=28Charlottenburg=29=5FHRB=5F1?=\t=?utf-8?Q?35+Aktueller=5FAbdruck-20190920?=\t=?utf-8?Q?095708=5Fpdf__eingef=C3=BCgt_am_20=5F09=5F1?=\t=?utf-8?Q?9_09=5F59.pdf?="},
         content_id=nil,
         description=nil,
         encoding="BASE64",
         size=107690,
         md5=nil,
         disposition=nil,
         language=nil,
         extension=nil>

I am using Ruby 2.4

Thanks in advance

Florian Eck
  • 495
  • 3
  • 13

0 Answers0