#!/usr/bin/perl use strict; use warnings; use Encode qw( encode decode ); my $unicode_name_CURRENCY_SIGN = chr(0xa4); sub _hex { my $str = shift; join '', map sprintf('%02X', ord($_)), split //, $str; } for (qw(ISO-8859-1 ISO-8859-15 windows-1252 UTF-8)) { printf "%s %s\n", $_, _hex(encode($_, $unicode_name_CURRENCY_SIGN)); } __END__ ISO-8859-1 A4 ISO-8859-15 3F windows-1252 A4 UTF-8 C2A4