I have this string " țara " which contains a character ț which is stored on 2 bytes.

When i do in linux : hexdump -C file that contains the string it shows :

00000000  c8 9b 61 72 61                                    |..ara|
00000005

It is normaly to view c8 and 9b ? This isn't the code point in hex of ț .
When we take the same string and put it here : txt_to_hex
We get :

 021b 61 72 61

Where 021b is the code point of ț showed in hexa.

Why does hexdump shows a wrong result ? c8 9b is different from 021b ,that means is not showing us the same character.

It seems to be the difference between UTF-8 hex and UTF-16 hex (See encodings section here)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.