Subject: bug#17961: "od -c" producing numbers greater than 255 ?

From: Eric Blake <[email-masked]>
Date: Mon, 07 Jul 2014 06:56:52 -0600

On 07/06/2014 06:27 PM, Sebastian Pipping wrote:
> Hello!
> 
> 
> Intersting, thanks for your reply.  For "-c" the man page reads
> 
>   "printable character or backslash escape"
> 
> I don't really see any mention of octal fallback in there :)
> Personally, I would expect (and prefer) \x?? output for any
> non-printable bytes from that description.  My vote too add that or at
> least making the man page more precise about "-c", that would be cool.

Alas, we can't change the behavior; it is mandated by POSIX:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/od.html

-c
    [XSI] [Option Start] Interpret bytes as characters specified by the
current setting of the LC_CTYPE category. Certain non-graphic characters
appear as C escapes: "NUL=\0", "BS=\b", "FF=\f", "NL=\n", "CR=\r",
"HT=\t"; others appear as 3-digit octal numbers. [Option End]

> 
> I guess "od -t u1" is what I'll use in the meantime.

Yes, that is a reasonable action.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org