Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: How to print the actual bytes of UTF-8 characters ?

by pajout (Curate)
on Feb 07, 2014 at 13:09 UTC ( #1073875=note: print w/replies, xml ) Need Help??


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

I think you need something like this:
#!/usr/bin/perl use utf8; my $str = ' '; print $str."\n"; foreach my $ch (split('', $str)) { print ord($ch)."\n"; } use bytes; print "bytes\n"; foreach my $ch (split('', $str)) { printf("%x %b\n", ord($ch), ord($ch)); }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1073875]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2020-05-25 08:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (144 votes). Check out past polls.

    Notices?