I want to display the hex byte sequence for the character under the cursor as it is actually stored on disk.
Currently my status line contains 0x%04.5B
which works fine for ASCII/latin1 files but for UTF-8 it only gives me the Unicode code point which is not what is actually stored on disk.
For example, for the German letter Ä
it shows 0x00C4
which corresponds to Unicode character U+00C4
. But the actual UTF-8 encoding is c3 84
.
I also know about ga
and g8
but I don't know how to use their output in the status line.
What I want to achieve:
- For
utf-8
files show the output ofg8
in the status line - For
latin1
files show theHex ...
part ofga
in the status line