# [pdftex] How to handle different tex encoding files?

Reinhard Kotucha reinhard.kotucha at web.de
Fri Feb 23 22:33:34 CET 2007

```>>>>> "Martin" == Martin Schröder <martin at oneiros.de> writes:

> 2007/2/23, Reinhard Kotucha <reinhard.kotucha at web.de>:
>> > ! Package inputenc Error: Keyboard character used is undefined
>> > (inputenc) in inputencoding `latin1'.
>>
>> If the input encoding of your TeX file is latin1 and you insert
>> stuff from another file which uses another encoding vector, this
>> will always fail.

> You can switch input encodings (with care) in mid-document with
> \inputencoding{foo}...\inputencoding{bar}.

I guess that emacs will have a problem if you have stuff with
different encodings in one file.  AFAIK there can be only one encoding
per file.  At least, if there are characters which are not supported
by the current encoding you'll be asked which encoding should be used
when saving the file.

However,  you can switch between input encodings (without much care)
if you split the document into different files and set \inputencoding
at the top of each file.

Coming back to the original question, I think your hint is quite
useful.  If you have to insert some text with an unknown encoding it
is quite safe to put it into a separate file and use \input to
integrate it into the document.  You don't have to be careful at all
when you try \inputencoding with different arguments because a wrong
value does not break anything.  If the encoding is unknown, you can
try all encodings supported by LaTeX until you find one which works
properly.

If the encoding of stuff pasted into emacs from another file, which
encoding is unknown, I suppose that if you switch to fundamental-mode
the file is treated as a binary and it is saved as it is.

Regards,
Reinhard

--
----------------------------------------------------------------------------
Reinhard Kotucha			              Phone: +49-511-4592165
Marschnerstr. 25
D-30167 Hannover	                      mailto:reinhard.kotucha at web.de
----------------------------------------------------------------------------
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.
----------------------------------------------------------------------------

```