[texhax] unicode

Alexander Grahn A.Grahn at fz-rossendorf.de
Fri Aug 5 10:36:59 CEST 2005


Thanks, again!

On Thu, Aug 04, 2005 at 04:44:31PM +0100, Philip TAYLOR wrote:
>Interesting -- I get the same in LaTeX but not in TeX;

For LaTeX to work one must put a backslash in front of `^':
  \catcode`\^^XX=12 ,
`XX' being the hexcode of the char.

On Thu, Aug 04, 2005 at 12:14:13PM -0400, Karl Berry wrote:
>Maybe it's the catcode?

Ok, I've set the catcode to 12 for chars with hexvalue less than 20.
This seems to work, but only chars with value >= x20 are written out
correctly as single bytes with the corresponding value. The smaller ones
are somehow expanded.

Ex. 1 (^^20):
=============
  \documentclass{article}
  \newwrite\outfile%
  \immediate\openout\outfile=out.txt%
  \catcode`\^^20=12    % not necessary for chars >= ^^20 
  \immediate\write\outfile{^^20}%
  \immediate\closeout\outfile%
  \begin{document}
  \end{document}
  
  Hexdump of out.txt:
  200a
  --> correct byte x20 followed by EOL char

Ex. 2 (^^19):
=============
  \catcode`\^^19=12
  \immediate\write\outfile{^^19}%
  
  Hexdump of out.txt:
  5e5e590a
  And my editor shows:
  ^^Y
  --> wrong, 3 bytes plus EOL char written

This happens with all chars from ^^00 to ^^19, :(, and contradicts to
what is said on p. 45 of the TeXBook.

Alex



More information about the texhax mailing list