in reply to How to print the actual bytes of UTF-8 characters ?

For simplicity, I would deal with the integer values. (The following was adapted from a one-liner, and made heavy use of Tom Christiansen's Unicode articles on perl.com.)

# Header from Unicode articles use utf8; use v5.12; use strict; use warnings; use warnings qw(FATAL utf8); use open qw(:std :utf8); use charnames qw(:full :short); $| = 1; my $format_string = qq{%2s %6d %6x %24b %3x %3x %8b %8b\n}; foreach my $i ( 0x0000 .. 0xD799, 0xE000 .. 0xFFFF ) { my @p; { my $j = $i; while ( $j ) { # print $j; push @p, $j & 0xFF; $j >>= 8; } @p = reverse @p; while ( scalar @p < 2 ) { unshift @p, 0; } } eval { print sprintf $format_string, chr($i), $i, $i, $i, @p, @p; } or print $!, qq{\n}; }

(I don't work with Unicode often, but there was an error thrown when I tried using 0xD800 as a character. I seem to remember there are some ranges that may not be defined, so adding anything above 0xD799 and formatting changes are left as exercises for the reader.)

Hope that helps.

Update: 2014-02-06

This article shed light on why 0xD800-0xDFFF are considered invalid. The code above was updated to skip said range.

Update: 2014-02-06

Remove left-over debug print(); add eval() around print to catch invalid Unicode points.