#!/usr/bin/perl use strict; use warnings; use Encode qw/encode decode/; my ($byte,$decoded); #get bytes $byte=`perl -MEncode -e "print encode('UTF-8',chr(hex('00E9')))"`; #decode bytes to char $decoded=decode('UTF-8', $byte); #encode char to byte for print print encode('UTF-8', $decoded) #### #!/usr/bin/perl use strict; use warnings; use Encode qw/encode decode/; my ($byte,$decoded); #$byte=chr(hex('0041')); $byte=chr(hex('00E9')); #decode bytes to char $decoded=decode('UTF-8', $byte); #encode char to byte for print print encode('UTF-8', $decoded); #### #!/usr/bin/perl use strict; use warnings; use Encode qw/encode decode/; my ($chr,$decoded); $chr=chr(hex('00E9')); #it is already not bytes but character. #use utf8::upgrade from "native encoding" to "UTF-8 encoding"(perl internal) utf8::upgrade($chr); #now you can encode char to byte for print print encode('UTF-8', $chr);