Email subject MIME encoding in Perl.

前端 未结 2 1220
醉梦人生
醉梦人生 2021-01-24 02:06

I am trying to send an email with non-ASCII characters in the subject line under Perl 5.8.5. My simple example uses the word \"Änderungen\" (German umlaut), but instead of corre

2条回答
  •  无人共我
    2021-01-24 02:20

    Your editor treats the file as UTF-8, so it shows

    my $subject = "Änderungen";
    

    Perl effectively treats the file as iso-8859-1, so it sees

    my $subject = "Ã?nderungen";
    

    Tell Perl you encoded your script using UTF-8 by adding

    use utf8;
    

提交回复
热议问题