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: Peng Yu
Subject: Re: [bug-gawk] How to print an unsigned char?
Date: Sun, 24 Feb 2019 11:26:08 -0600

Is there a way to make this happen inside awk code instead of doing
via an environment variable?

On 2/19/19, david kerns <address@hidden> wrote:
> 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
>>
>>
>


-- 
Regards,
Peng



reply via email to

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