\immediate\write\SomeStream{x} writes x to the file open in \SomeStream. I would like to write non-printable ASCII characters, such as ``, to a file. My naive guess is
\begingroup %To keep the catcode change local
\catcode`\=11
\immediate\write\SomeStream{}
\endgroup
But this writes the three characters ^^A instead of the single character ``. Is there a way to prevent TeX from sanitizing its output?
MWE:
\documentclass{minimal}
\newwrite\SomeStream
\immediate\openout\SomeStream NonPrintableASCII.test
\begingroup %To keep the catcode change local
\catcode`\=11
\immediate\write\SomeStream{}
\endgroup
\immediate\closeout\SomeStream
\begin{document}
\end{document}
EDIT: My goal was to write a file and reread it with potentially crazy catcode changes (And I am using non-printable characters rather than ^^A to be more robust.). \scantokens does the job (see below).
%& -translate-file=natural.tcx– TH. Jan 12 '11 at 11:35