summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/enctex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-12-21 17:23:38 +0000
committerKarl Berry <karl@freefriends.org>2012-12-21 17:23:38 +0000
commit1ecf8b73c2570794c61fc9773c79a9b8b76c4567 (patch)
treed8ba421e6b4eb5b29999a440911001d064a053bb /Master/texmf-dist/tex/generic/enctex
parent7ff68f1c15e668668219c93f95524a45e383b163 (diff)
manual update of enctex files in csplain.tar.gz
git-svn-id: svn://tug.org/texlive/trunk@28601 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/enctex')
-rw-r--r--Master/texmf-dist/tex/generic/enctex/utf8unkn.tex56
1 files changed, 42 insertions, 14 deletions
diff --git a/Master/texmf-dist/tex/generic/enctex/utf8unkn.tex b/Master/texmf-dist/tex/generic/enctex/utf8unkn.tex
index 462a23acbaf..88a9027906c 100644
--- a/Master/texmf-dist/tex/generic/enctex/utf8unkn.tex
+++ b/Master/texmf-dist/tex/generic/enctex/utf8unkn.tex
@@ -2,6 +2,8 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Feb. 6. 2003 Petr Olsak
%
+% Oct. 2012: More robust macros by \long, \noexpand, \badutfinput (P.O.)
+%
% 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.
@@ -13,7 +15,7 @@
\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 ^^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
@@ -24,20 +26,48 @@
\mubyte \writeparameter \relax \endmubyte \def\writeparameter{}
-\def\warntwobytes #1#2{%
+\long\def\warntwobytes #1#2{%
\ifx\writeparameter\relax % write parameter copies unknown code
- \noconvert#1\noconvert#2% to output without any change
+ \expandafter\noconvert\noexpand#1%
+ \expandafter\noconvert\noexpand#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%
+ \if\noexpand#2\relax \badutfinput \else
+ \ifnum`#2<128 \badutfinput \else
+ \missingutfchar{\expandafter\noconvert\noexpand#1%
+ \expandafter\noconvert\noexpand#2}%
+ \fi\fi\fi}
+\long\def\warnthreebytes #1#2#3{\ifx\writeparameter\relax
+ \expandafter\noconvert\noexpand#1%
+ \expandafter\noconvert\noexpand#2%
+ \expandafter\noconvert\noexpand#3%
\else
- \message{WARNING: unknown UTF-8 code:
- ``\noconvert#1\noconvert#2\noconvert#3''}%
- \leavevmode\hbox{\vrule width.5em height.5em}%
- \fi}
+ \if\noexpand#2\relax \badutfinput \else
+ \ifnum`#2<128 \badutfinput \else
+ \missingutfchar{\expandafter\noconvert\noexpand#1%
+ \expandafter\noconvert\noexpand#2%
+ \expandafter\noconvert\noexpand#3}%
+ \fi\fi\fi}
+\def\badutfinput{%
+ \errhelp={Try to set mubytein=0 or input utf8off or input mixcodes.}
+ \errmessage{UTF-8 INPUT IS CORRUPTED !
+ \space May be you are using another input encoding}}
+\def\missingutfchar#1{{\day=0
+ \ifnum\day=0 % this makes me more robust in message prameter
+ \newlinechar=`^^J \chardef\$=\xprncode255
+ \xprncodes=1 \message{WARNING: unknown UTF-8 code: `#1 =}%
+ \xprncodes=0 \message{#1' (line: \the\inputlineno)}%
+ \xprncodes=\$
+ \leavevmode\hbox{\kern.05em\vrule width.5em height.5em\kern.05em}%
+ \else unknown UTF-8 code `#1'\fi}}
+
+% \xprncodes=1 or \xprncodes=0 .. set/unset printability of 128..255 chars
+
+\def\xprncodes=#1 {%
+ \count255=128
+ \loop \xprncode\count255=#1\advance\count255 by 1
+ \ifnum \count255<256 \repeat
+}
+
\ifx\unknowncodes\relax \endinput \fi % you can \let\unknowncodes\relax
% if you don't want to active
@@ -45,5 +75,3 @@
\setunknowncodes
\endinput
-
-