Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Printing a UTF8 code

by Anonymous Monk
on Nov 09, 2019 at 07:50 UTC ( #11108511=note: print w/replies, xml ) Need Help??


in reply to Printing a UTF8 code

print FO "\x{00b9}"; Outputs a strange character
With no :encoding layer set on the file handle, Perl outputs characters with codes below 0x100 directly as bytes. This is done for byte transparency (to allow strings to consist of arbitrary bytes) and backwards compatibility:
$ perl -e 'print "\x{00b9}"' | hd 00000000 b9 |.| ^^-- notice the literal byte 0xB9 $ perl -CO -e 'print "\x{00b9}"' | hd 00000000 c2 b9 |..| ^^^^^-- this is the UTF-8 byte sequence for U+00B9

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (3)
As of 2020-04-04 01:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The most amusing oxymoron is:
















    Results (32 votes). Check out past polls.

    Notices?