May-21-2018, 10:27 AM
Iconv works with the raw values, if you have it as a hex string you need to transform it first.
And the result is also raw bits, so:
I find xxd more practical than hexdump, although you can achieve similar results.
And the result is also raw bits, so:
Output:$> echo "にほんご" | iconv -f UTF-8 -t UTF-16 | xxd -p
fffe6b307b30933054300a00
$> echo -n fffe6b307b30933054300a00 | xxd -r -p | iconv -f UTF-16 -t UTF-8
にほんご
You need to have some font with japanese characters to see this correctly...I find xxd more practical than hexdump, although you can achieve similar results.