in reply to How to print the actual bytes of UTF-8 characters ?
Using a variable as a file to handle the encodings:
#!/usr/bin/perl use warnings; use strict; use utf8; for my $char (qw(Ð Ñ Ò Ó)) { my $n = ord $char; open my $BYTE, '>:utf8', \ my $bytes; print {$BYTE} $char; printf "%s\t%s\t%x\t%b\t%x %x\t %b %b\n", $char, $n, $n, $n, (unpack('CC', $bytes)) x 2; }
The pivoting of the table left as an exercise to the reader.
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: How to print the actual bytes of UTF-8 characters ?
by RCH (Sexton) on Feb 06, 2014 at 16:18 UTC | |
by choroba (Cardinal) on Feb 06, 2014 at 17:16 UTC | |
by RCH (Sexton) on Feb 06, 2014 at 17:49 UTC | |
Re^2: How to print the actual bytes of UTF-8 characters ?
by ikegami (Patriarch) on Feb 07, 2014 at 21:14 UTC |
In Section
Seekers of Perl Wisdom