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

Hi, I need help with Umlauts(German). I'm reading mails using MAIL::IMAPClient and printing them to a file based on search. The output is printed in non utf8 and the German special chars(Umlauts) as printed as =C3=BC =C3=B6 =C3=A4 Please let me know how can I encode to print umlauts. Thanks

Replies are listed 'Best First'.
Re: need help in printing German umlauts
by AppleFritter (Vicar) on Jul 08, 2014 at 09:29 UTC
      I tried the above example provided and it works perfectly fine.
      But when I tried the below it fails.
      #!/usr/bin/perl use feature qw/say/; use warnings; use strict; use Encode; #assuming that my message is stored in some variable called $str my $str="Wir freuen uns, dass Sie den 1&1 E-Mail-Service f=C3=BCr Ihre +=20"; print decode('MIME-Header', "Wir freuen uns, dass Sie den 1&1 E-Mail-S +ervice f=C3=BCr Ihre=20"); print "\n"; print decode('MIME-Header', "=?iso-8859-1?Q?".$str);
      Thanks
      Arun

        Don't forget the trailing ?=:

        #!/usr/bin/perl use feature qw/say/; use warnings; use strict; use Encode; my $str = "Wir freuen uns, dass Sie den 1&1 E-Mail-Service f=C3=BCr Ih +re=20"; say decode('MIME-Header', "=?iso-8859-1?Q?" . $str . "?=");

        Output:

        $ perl 1092761.pl Wir freuen uns, dass Sie den 1&1 E-Mail-Service für Ihre $