I have a small shellscript in .x
$ cat .x
u="Böhmáí"
touch "$u"
ls > .list
echo "$u" >.text
cat .list .text
diff .list .text
od -bc .list
od -bc .text
When i run this scrpit sh -x .x
(-x only for showing commands)
$ sh -x .x
+ u=Böhmáí
+ touch Böhmáí
+ ls
+ echo Böhmáí
+ cat .list .text
Böhmáí
Böhmáí
+ diff .list .text
1c1
< Böhmáí
---
> Böhmáí
+ od -bc .list
0000000 102 157 314 210 150 155 141 314 201 151 314 201 012
B o ̈ ** h m a ́ ** i ́ ** \n
0000015
+ od -bc .text
0000000 102 303 266 150 155 303 241 303 255 012
B ö ** h m á ** í ** \n
0000012
The same string Böhmáí
has encoded into different bytes in the filename vs as a content of a file. In the terminal (utf8-encoded) the string looks same
in both variants.
Where is the rabbit?