I am trying to identify a strange character I have found in a file I am working with:
$ cat file
�
$ od file
0000000 005353
0000002
$ od -c file
0000000 353 \n
0000002
$ od -x file
0000000 0aeb
0000002
The file is using ISO-8859 encoding and can't be converted to UTF-8:
$ iconv -f ISO-8859 -t UTF-8 file
iconv: conversion from `ISO-8859' is not supported
Try `iconv --help' or `iconv --usage' for more information.
$ iconv -t UTF-8 file
iconv: illegal input sequence at position 0
$ file file
file: ISO-8859 text
My main question is how can I interpret the output of od
here? I am trying to use this page which lets me translate between different character representations, but it tells me that 005353
as a "Hex code point" is 卓
which doesn't seem right and 0aeb
as a "Hex code point" is ૫
which, again, seems wrong.
So, how can I use any of the three options (355
, 005353
or 0aeb
) to find out what character they are supposed to represent?
And yes, I did try with Unicode tools but it doesn't seem to be a valid UTF character either:
$ uniprops $(cat file)
U+FFFD ‹�› \N{REPLACEMENT CHARACTER}
\pS \p{So}
All Any Assigned Common Zyyy So S Gr_Base Grapheme_Base Graph X_POSIX_Graph
GrBase Other_Symbol Print X_POSIX_Print Symbol Specials Unicode
if I understand the description of the Unicode U+FFFD character, it isn't a real character at all but a placeholder for a corrupted character. Which makes sense since the file isn't actually UTF-8 encoded.
iconv
complains because you didn’t specify the source character set, so it uses your default which is probably UTF-8.)ë
is what I see when the data is used on another program! But how can I know this? Isn't it somewhere in the data I provide? How did you find it? Oh I had triediconv
with-f ISO-8859
but it complained aboutconversion from
ISO-8859' is not supported`.eb
and ignore the0x
hex indicator or whatever that is. My ignorance of this sort of thing is deep. Could you post an answer explaining that @StephenKitt?iconv
would have succeeded; and/or you could have looked it up e.g. on Wikipedia. For this very specific encoding, fileformat.info/info/unicode/char/00eb/index.htm also works (Unicode is equivalent to ISO-8859-1 in the range 128-255, though of course no UTF encoding is compatible with it).