blob: 462a23acbaf49b8e6ca697de81751b8efe13458d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
% utf8unkn.tex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Feb. 6. 2003 Petr Olsak
%
% This macro sets all others UTF-8 codes (not declared formerly or
% later) as "unknown" by encTeX primitives. You need the version
% Feb. 2003 of encTeX or later.
%
% You can re-define the \warntwobytes and \warnthreebytes macros
% if you need it. The default value of these macros is that
% the black box is typeset and warning is printed by \message
% and the unknown code is printed without any change to \write files.
\def\setunknowncodes {\bgroup
\def\a ##1{\mubyte \warntwobytes ####2 ##1\endmubyte}
\a ^^c0 \a ^^c1 \a ^^c2 \a ^^c3 \a ^^c4 \a ^^c5 \a ^^c6 \a ^^c7
\a ^^c8 \a ^^c9 \a ^^ca \a ^^cb \a ^^cc \a ^^cd \a ^^ce \a ^^cf
\a ^^d0 \a ^^d1 \a ^^d2 \a ^^d3 \a ^^d4 \a ^^d5 \a ^^d6 \a ^^d7
\a ^^d8 \a ^^d9 \a ^^da \a ^^db \a ^^dc \a ^^dd \a ^^de \a ^^df
\def\a ##1{\mubyte \warnthreebytes ####3 ##1\endmubyte}
\a ^^e0 \a ^^e1 \a ^^e2 \a ^^e3 \a ^^e4 \a ^^e5 \a ^^e6 \a ^^e7
\a ^^e8 \a ^^e9 \a ^^ea \a ^^eb \a ^^ec \a ^^ed \a ^^ee \a ^^ef
\egroup}
\mubyte \writeparameter \relax \endmubyte \def\writeparameter{}
\def\warntwobytes #1#2{%
\ifx\writeparameter\relax % write parameter copies unknown code
\noconvert#1\noconvert#2% to output without any change
\else
\message{WARNING: unknown UTF-8 code: ``\noconvert#1\noconvert#2''}%
\leavevmode\hbox{\vrule width.5em height.5em}%
\fi}
\def\warnthreebytes #1#2#3{\ifx\writeparameter\relax
\noconvert#1\noconvert#2\noconvert#3%
\else
\message{WARNING: unknown UTF-8 code:
``\noconvert#1\noconvert#2\noconvert#3''}%
\leavevmode\hbox{\vrule width.5em height.5em}%
\fi}
\ifx\unknowncodes\relax \endinput \fi % you can \let\unknowncodes\relax
% if you don't want to active
% the warncodes immediatelly
\setunknowncodes
\endinput
|