[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is there a way to print unicode characters and the actual code?
From: |
Pádraig Brady |
Subject: |
Re: Is there a way to print unicode characters and the actual code? |
Date: |
Sat, 24 Feb 2018 18:02:43 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 |
On 24/02/18 08:53, Peng Yu wrote:
> It seems that `od` does not respect the unicode.
>
> Is there a tool (maybe different from od) that can print the code in
> odd lines and the unicode character in even lines? Thanks.
>
> $ od -xc <<< 'exámple'
> 0000000 7865 a1c3 706d 656c 000a
> e x ? ? m p l e \n
> 0000011
>
> In this particular case, I'd like it to print something like the
> following (positions are omitted). Is there a tool for doing so?
>
> 65 78 c1 6d 70 6c 65 0a
> e x á m p l e \n
od doesn't support that at present.
Perhaps we could have another -t option to support that.
Note we have to consider alignment. Consider:
$ od -An -tx1 -ta -tc <<< 'exámple'
65 78 c3 a1 6d 70 6c 65 0a
e x C ! m p l e nl
e x 303 241 m p l e \n
cheers,
Pádraig