# What is the equivalent of \usepackage[T1]{fontenc} in plain TeX?

I have inherited a semi-small TeX project in which I, after syncing across various computers and OS'es, had some problems with encodings of special characters like åäö.

My initial approach for fixing this was to convert everything to UTF-8 (using the iconv utility on Ubuntu), which made all the weird incorrect replacement characters disappear. However, the special characters still don't show up.

If this was LaTeX, I'd do \usepackage[T1]{fontenc}, but that doesn't work here because I compile with pdftex.

• Is pdftex utf8 agnostic? You probably need xetex or luatex and you have to specify a font that supports these chars. BTW: interesting question. – daleif Aug 26 '15 at 10:55
• There is no specific encoding support in plain, just load a T1 (8t) encoded font using \font. – David Carlisle Aug 26 '15 at 10:55
• Are you sure you want UTF8 it would be much easier to handle latin 1 in plain TeX. – David Carlisle Aug 26 '15 at 10:56
• So, are you using pdftex with utf8 encoded files? – jarnosz Sep 1 '15 at 21:02

At first you don't need an equivalent for fontenc but for inputenc. You should (like inputenc) make the non-ascii chars active and map them to suitable commands. E.g. in an 8-bit encoded file you could do something like this:

%OT1-encoded font
\catcode\ä=13
\defä{\"a}

Räuber
\bye


When using a T1-encoded font life is a bit easier, as a lot of chars are already in "the correct position". So the catcode changes are often not really needed, but as you can see with the ß some chars can be wrong if you don't add a definition

%Use a T1-encoded font:
%\catcode\ä=13
%\defä{\char"E4}
% \catcode\ß=13
% \defß{\char"FF}
%
\font\test=ecrm1000 \test

Räuber öäüß
\bye


With an utf8 encoded file life gets much more complicated as then you will have to recreate the parsing of the utf8 octets.

With the csplain or pdfcsplain format (http://petr.olsak.net/csplain-e.html) you can use utf8 directly.
öäüß

• The first case breaks the \uppercase` command, you don't get uppercased accented letters. And the second is interesting because when you write an external file it is written with a different encoding, so a table of contents does not work with that. Any idea on solving that without csplain? – blmayer Jan 15 '16 at 17:27