use utf8; use Encode; my $code = 208; # the unicode expressed as decimal my $char = chr($code); # convert to internal perl character my $utf8_octets = encode("UTF-8", $ch); # get sequence of bytes in UTF-8 print sprintf("Decimal: %d, Hex: %x, Bits: %b\n", $code, $code, $code); print "UTF-8 hex: ", unpack("H*", $utf8_octets), "\n"; print "UTF-8 bits: ", unpack("B*", $utf8_octets), "\n";