summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/base/utf8ienc.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/base/utf8ienc.dtx')
-rw-r--r--Master/texmf-dist/source/latex/base/utf8ienc.dtx49
1 files changed, 37 insertions, 12 deletions
diff --git a/Master/texmf-dist/source/latex/base/utf8ienc.dtx b/Master/texmf-dist/source/latex/base/utf8ienc.dtx
index b67c9361eed..993f59c4818 100644
--- a/Master/texmf-dist/source/latex/base/utf8ienc.dtx
+++ b/Master/texmf-dist/source/latex/base/utf8ienc.dtx
@@ -217,7 +217,7 @@
%<+ts1> \ProvidesFile{ts1enc.dfu}
%<+x2> \ProvidesFile{x2enc.dfu}
%<+all> \ProvidesFile{utf8enc.dfu}
- [2018/04/05 v1.2c UTF-8 support for inputenc]
+ [2018/10/05 v1.2f UTF-8 support for inputenc]
% \end{macrocode}
%
% \begin{macrocode}
@@ -323,9 +323,10 @@
% \begin{macro}{\UTFviii@invalid@err}
% \begin{macro}{\UTFviii@invalid@help}
% \changes{v1.2a}{2018/03/24}{Macro added}%
+% \changes{v1.2f}{2018/10/05}{Show invalid byte in hex}%
% \begin{macrocode}
\def\UTFviii@invalid@err#1{%
- \PackageError{inputenc}{Invalid UTF-8 byte \number`#1}%
+ \PackageError{inputenc}{Invalid UTF-8 byte "\UTFviii@hexnumber{`#1}}%
\UTFviii@invalid@help}
% \end{macrocode}
%
@@ -463,9 +464,10 @@
% \end{macrocode}
%
% Setting up 4-byte UTF-8:
+% \changes{v1.2e}{2018/09/28}{Fix "F4 lead byte}%
% \begin{macrocode}
\count@"F0
- \@tempcnta"F4
+ \@tempcnta"F5
\def\UTFviii@tmp{\xdef~{\noexpand\UTFviii@four@octets\string~}}
\UTFviii@loop
% \end{macrocode}
@@ -473,7 +475,7 @@
% Bytes above F4 are not valid UTF-8 starting bytes as they would encode numbers beyond
% the Unicode range
% \begin{macrocode}
- \count@"F4
+ \count@"F5
\@tempcnta"100
\def\UTFviii@tmp{\xdef~{\noexpand\UTFviii@invalid@err\string~}}
\UTFviii@loop
@@ -620,7 +622,7 @@
% |\parse@XML@charref| work without arguments.
% \changes{v1.1g}{2005/09/27}{Real spaces do not show up so use \cs{space}}
% \changes{v1.2a}{2018/03/24}{Allow control characters if active}
-% In the case single byte UTF-8 sequences, only allw definition if
+% In the case single byte UTF-8 sequences, only allow definition if
% the character os already active. The definition of |\UTFviii@tmp|
% looks slightly strange but is designed for the sequence of |\expandafter|
% in |\DeclareUnicodeCharacter|.
@@ -650,6 +652,20 @@
\parse@UTFviii@a,%
\parse@UTFviii@b E\UTFviii@three@octets.{,;}%
\else
+% \end{macrocode}
+%
+% Test added here for out of range values, the 4-octet definitions are still set up
+% so that |\DeclareUnicodeCharacter| does something sensible if the user scrolls
+% past this error.
+% \begin{macrocode}
+ \ifnum\count@>"10FFFF\relax
+ \PackageError{inputenc}%
+ {\UTFviii@hexnumber\count@\space too large for Unicode}%
+ {Values between 0 and 10FFFF are permitted}%
+ \fi
+% \end{macrocode}
+%
+% \begin{macrocode}
\parse@UTFviii@a;%
\parse@UTFviii@a,%
\parse@UTFviii@a!%
@@ -793,23 +809,28 @@
%
% \begin{macro}{\UTFviii@splitcsname}
% \changes{v1.1o}{2015/08/28}{Macro added}
+% \begin{macro}{\UTFviii@hexcodepoint}
+% \changes{v1.2e}{2018/09/28}{Macro added: Format codepoint properly}
% Split a csname representing a unicode character and return
-% the character and (if |\numexpr| is defined) the unicode number in hex.
-% \begin{macrocode}
-\ifx\numexpr\@undefined
-\gdef\UTFviii@splitcsname#1:#2\relax{#2}}
-\else
+% the character and the unicode number in hex.
+% \begin{macrocode}
+\gdef\UTFviii@hexcodepoint#1{U+%
+ \ifnum#1<16 0\fi
+ \ifnum#1<256 0\fi
+ \ifnum#1<4096 0\fi
+ \UTFviii@hexnumber{#1}%
+}%
\gdef\UTFviii@splitcsname#1:#2\relax{%
% \end{macrocode}
% \changes{v1.2b}{2018/03/26}{add percent as \cs{endlinechar} not -1 in the format}%
% Need to pre-expand the argument to ensure cleanup in case of mal-formed UTF-8.
% \begin{macrocode}
-#2 (U+\expandafter\UTFviii@hexnumber\expandafter{%
+#2 (\expandafter\UTFviii@hexcodepoint\expandafter{%
\the\numexpr\decode@UTFviii#2\relax})%
}
-\fi
% \end{macrocode}
% \end{macro}
+% \end{macro}
%
% \begin{macrocode}
\endgroup
@@ -1232,10 +1253,13 @@
% \begin{macrocode}
%<all,t1>\DeclareUnicodeCharacter{0232}{\@tabacckludge=Y}
%<all,t1>\DeclareUnicodeCharacter{0233}{\@tabacckludge=y}
+%<all,t2c,t2b,t2a,t1,ot2,ot1,ly1,lcy>\DeclareUnicodeCharacter{0237}{\j}
%<all,ly1,utf8>\DeclareUnicodeCharacter{02C6}{\textasciicircum}
%<all,ts1>\DeclareUnicodeCharacter{02C7}{\textasciicaron}
%<all,ly1,utf8>\DeclareUnicodeCharacter{02DC}{\textasciitilde}
%<all,ts1>\DeclareUnicodeCharacter{02D8}{\textasciibreve}
+%<all,t1>\DeclareUnicodeCharacter{02D9}{\.{}}
+%<all,t1>\DeclareUnicodeCharacter{02DB}{\k{}}
%<all,ts1>\DeclareUnicodeCharacter{02DD}{\textacutedbl}
% \end{macrocode}
% The Cyrillic code points have been recently checked (2007) and extended
@@ -1530,6 +1554,7 @@
%<all,ts1>\DeclareUnicodeCharacter{0E3F}{\textbaht}
%<all,t1>\DeclareUnicodeCharacter{1E02}{\.B}
%<all,t1>\DeclareUnicodeCharacter{1E03}{\.b}
+%<all,t1>\DeclareUnicodeCharacter{1E9E}{\SS}
%<all,x2,t2c,t2b,t2a,t1,utf8>\DeclareUnicodeCharacter{200C}{\textcompwordmark}
% \end{macrocode}
% \changes{v1.1s}{2016/02/28}{Add more hyphens and dashes}