bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] How to print an unsigned char?


From: david kerns
Subject: Re: [bug-gawk] How to print an unsigned char?
Date: Tue, 19 Feb 2019 13:55:31 -0700

it's dependent on your locale

$ unset LC_ALL
$ gawk 'BEGIN { printf("%c", 137) }' | xxd
0000000: c289                                     ..
$ export LC_ALL=C
$ gawk 'BEGIN { printf("%c", 137) }' | xxd
0000000: 89                                       .



On Tue, Feb 19, 2019 at 1:42 PM Peng Yu <address@hidden> wrote:

> 137 is printed as two characters. Is there a way to print a single
> character corresponding the number 137 as in C?
>
> $ awk 'BEGIN { printf("%c", 137) }' | xxd
> 00000000: c289
>
> #include <stdio.h>
>
> int main() {
>         printf("%c", 137);
>         return 0;
> }                            ..
>
> $ ./main.exe |xxd
> 00000000: 89                                       .
>
> --
> Regards,
> Peng
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]