Re: What are the 94 printable characters from the 128 characters of ASCII table?



yudi v <yudi.tux@xxxxxxxxx> writes:

Hi Paul,
I am pretty sure you are mistaken,

126-32 = 94

Let's try a simpler range: 32 to 32 is 1 character. And 32 - 32
is, obviously, zero. Doesn't it seem like an off-by-one error?

and space is a printable character.

Well, I don't have an opinion of my own, but here's what GNU
Libc thinks on the issue:

$ cat < printable.c
#define _GNU_SOURCE
#include <ctype.h>
#include <stdio.h>

int
main ()
{
int i;

for (i = 0; i < 256; i++) {
printf (" %02x %s%s",
i,
(isprint (i) ? "P" : " "),
((1 + i) % 8 == 0
? "\n" : ""));
}

/* . */
return 0;
}
$ make printable
cc printable.c -o printable
$ ./printable
00 01 02 03 04 05 06 07
08 09 0a 0b 0c 0d 0e 0f
10 11 12 13 14 15 16 17
18 19 1a 1b 1c 1d 1e 1f
20 P 21 P 22 P 23 P 24 P 25 P 26 P 27 P
28 P 29 P 2a P 2b P 2c P 2d P 2e P 2f P
30 P 31 P 32 P 33 P 34 P 35 P 36 P 37 P
38 P 39 P 3a P 3b P 3c P 3d P 3e P 3f P
40 P 41 P 42 P 43 P 44 P 45 P 46 P 47 P
48 P 49 P 4a P 4b P 4c P 4d P 4e P 4f P
50 P 51 P 52 P 53 P 54 P 55 P 56 P 57 P
58 P 59 P 5a P 5b P 5c P 5d P 5e P 5f P
60 P 61 P 62 P 63 P 64 P 65 P 66 P 67 P
68 P 69 P 6a P 6b P 6c P 6d P 6e P 6f P
70 P 71 P 72 P 73 P 74 P 75 P 76 P 77 P
78 P 79 P 7a P 7b P 7c P 7d P 7e P 7f
80 81 82 83 84 85 86 87

f8 f9 fa fb fc fd fe ff
$

So, as per GNU Libc, the printable ASCII characters are 0x20 to
0x7e, inclusive, which amounts to (+ 1 #x7e #x-20) => 95
characters overall.

--
FSF associate member #7257


--
To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx
with a subject of "unsubscribe". Trouble? Contact listmaster@xxxxxxxxxxxxxxxx
Archive: http://lists.debian.org/868vrmsxru.fsf@xxxxxxxxxxxxxxxx



Relevant Pages

  • Re: spurious C warnings..
    ... 6809 home system - so I still tend to avoid making assumptions ... Anyway, your explanation makes sense. ... It first tries for int, ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)
  • Re: Beginner has trouble with SDL in foll-screen mode.
    ... In full-screen mode everything is sheared off into wavy lines, ... Uint8 green, ... int x, y, t; ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)
  • Re: Beginner has trouble with SDL in foll-screen mode.
    ... In full-screen mode everything is sheared off into wavy lines, ... Uint8 green, ... int x, y, t; ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)
  • Re: Slow Script
    ... so with 128M of memory he could hold 32 Million long int - I realise the ... Naturally, with 300 bytes records, you need 10G of spare ram .. ... Hey its just fortune quoting bush, ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)
  • Re: problems using wicd on WPA2 secured networks
    ... is that the key can be 8-63 printable ASCII characters or 64 hexadecimal ... Wicd just tells me that the connection is WPA2. ... WPA 1/2 Preshared Key ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx with a subject of "unsubscribe". ...
    (Debian-User)