Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

RE: RE: Chr and Ord

by sean (Beadle)
on Jun 16, 2000 at 05:42 UTC ( [id://18425]=note: print w/replies, xml ) Need Help??

in reply to RE: Chr and Ord
in thread Chr and Ord

Apparently, chr() gleefully discards all but the 8 least signifigant bits. (ascii characters are normally represented by 8 bits, btw. 2**8 = 256)
sean@strange:~$ perl -e 'print chr(80) . "\n"' P sean@strange:~$ perl -e 'print chr(80+256) . "\n"' P sean@strange:~$ perl -e 'print chr(80+256+256) . "\n"' P

Replies are listed 'Best First'.
RE: RE: RE: Chr and Ord
by Ovid (Cardinal) on Jun 16, 2000 at 08:38 UTC
    Thanks for explaining what was going on for chr()

    Regarding the 7-bit/255 characters thing, I can only plead temporary stupidity. The standard ASCII set (as defined by ANSI) is 128 7-bit characters. This link will take you to that set. Notice that it only goes up to x7E. If the eighth bit is set, then you hit the extended ASCII set. I found a few references to it, the clearest I found is at this link.

    Of course, this is only a feeble attempt at backpedaling :)

Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2024-04-25 06:03 GMT
Find Nodes?
    Voting Booth?

    No recent polls found