use Encode qw( encode_utf8 ); my $encoded = encode_qp(encode_utf8($str)); #### $ cat a.pl use strict; use warnings; use feature qw( say ); use utf8; use open ':std', ':encoding(UTF-8)'; use Encode qw( encode_utf8 ); use MIME::QuotedPrint qw( encode_qp ); for my $str ( "a\x{201E}z", "a„z", "a\x{201C}z", "a\x{03C9}z", "aäz", ) { say $str; my $str_q; if (!eval { $str_q = encode_qp($ARGV[0] ? encode_utf8($str) : $str); return 1; }) { warn($@); next; } print $str_q; }