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.


In reply to Re: How to print the actual bytes of UTF-8 characters ? by atcroft
in thread How to print the actual bytes of UTF-8 characters ? by RCH

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.