I'd like to write non-ASCII characters (0xfe
, 0xed
, etc) to a program's standard input.
There are a lot of similar questions to this one, but I didn't find an answer, because:
- I want to write single-byte characters, not unicode characters
- I can't pipe the output of
echo
or something
On OS X¹ you can test with:
nm - -
I'd like to write object files magic bytes (e.g. 0xfeedface
) to nm
using standard input so I can see how it does behave and I can recode it.
If I use a pipe then the second argument -
, which means stdin, will never match any bytes since all the standard input will go to the first one. When using a terminal instead of a pipe, I can type Ctrl + D
so the first one gets 'closed' and the second one start reading.
I tried with Ctrl + Shift + U
and the Unicode Hex Input of OS X but it doesn't work -- I can't write the desired characters with it.
I also tried with the clipboard with pbcopy
but it fails to read/paste non-ASCII or non-unicode characters.
How can I achieve my goal?
Don't hesitate to edit as this was a difficult question to express.
¹ The nm
on linux does not handle stdin.