my $bin_msg = ...; my $txt_msg = decode($encoding, $bin_msg);