%%
%% This is file `se-utf8.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% stringenc.dtx  (with options: `utf8')
%% 
%% This is a generated file.
%% 
%% Project: stringenc
%% Version: 2019/11/29 v1.12
%% 
%% Copyright (C)
%%    2007-2011 Heiko Oberdiek
%%    2016-2019 Oberdiek Package Support Group
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3c of this license or (at your option) any later
%% version. This version of this license is in
%%    https://www.latex-project.org/lppl/lppl-1-3c.txt
%% and the latest version of this license is in
%%    https://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
%% 
%% This work has the LPPL maintenance status "maintained".
%% 
%% The Current Maintainers of this work are
%% Heiko Oberdiek and the Oberdiek Package Support Group
%% https://github.com/ho-tex/stringenc/issues
%% 
%% 
%% The Base Interpreter refers to any `TeX-Format',
%% because some files are installed in TDS:tex/generic//.
%% 
%% This work consists of the main source file stringenc.dtx
%% and the derived files
%%    stringenc.sty, stringenc.pdf, stringenc.ins, stringenc.drv,
%%    se-utf32be.def, se-utf32le.def, se-utf8.def, se-utf16le.def,
%%    se-pdfdoc.def, se-iso-8859-1.def, se-cp1252.def,
%%    se-ascii.def, se-ascii-print.def, se-clean7bit.def,
%%    se-iso-8859-2.def, se-iso-8859-3.def, se-iso-8859-4.def,
%%    se-iso-8859-5.def, se-iso-8859-6.def, se-iso-8859-7.def,
%%    se-iso-8859-8.def, se-iso-8859-9.def, se-iso-8859-10.def,
%%    se-iso-8859-11.def, se-iso-8859-13.def, se-iso-8859-14.def,
%%    se-iso-8859-15.def, se-iso-8859-16.def, se-koi8-r.def,
%%    se-nextstep.def, se-mac-centeuro.def, se-mac-cyrillic.def,
%%    se-mac-roman.def, se-dec-mcs.def, se-cp437.def,
%%    se-cp850.def, se-cp852.def, se-cp855.def, se-cp858.def,
%%    se-cp865.def, se-cp866.def, se-cp1250.def, se-cp1251.def,
%%    se-cp1257.def, stringenc-test1.tex, stringenc-test2.tex.
%% 
\ProvidesFile{se-utf8.def}[2019/11/29 v1.12 stringenc: UTF-8]
\expandafter\gdef\csname\SE@PrefixTo utf8\endcsname#1#2#3#4{%
  \ifnum"#1#2#3#4<"80 %
    \SE@ResultAdd{#3#4}%
  \else
    \ifnum"#1#2#3#4<"800 %
      \edef\SE@temp{%
        \SE@Nibble@NumToBin{"#3}%
      }%
      \edef\SE@temp{%
        11%
        \SE@Nibble@NumToBin{"#2}%
        \expandafter\SE@CarTwo\SE@temp\@nil
        10%
        \expandafter\ltx@gobbletwo\SE@temp
      }%
      \SE@ResultAdd{%
        \SE@Nibbles@BinToHex\SE@temp
        #4%
      }%
    \else
      \edef\SE@temp{%
        \SE@Nibble@NumToBin{"#3}%
      }%
      \edef\SE@temp{%
        10%
        \SE@Nibble@NumToBin{"#2}%
        \expandafter\SE@CarTwo\SE@temp\@nil
        10%
        \expandafter\ltx@gobbletwo\SE@temp
      }%
      \SE@ResultAdd{%
        E#1%
        \SE@Nibbles@BinToHex\SE@temp
         #4%
      }%
    \fi
  \fi
}
\expandafter\gdef\csname\SE@PrefixSurrogateTo utf8\endcsname
    #1#2#3#4#5#6#7#8{%
  \edef\SE@w{\SE@Nibble@NumToBin{"#2}}%
  \edef\SE@a{\SE@Nibble@NumToBin{"#3}}%
  \edef\SE@b{\SE@Nibble@NumToBin{"#4}}%
  \edef\SE@c{\SE@Nibble@NumToBin{"#6}}%
  \edef\SE@d{\SE@Nibble@NumToBin{"#7}}%
  \edef\SE@w{%
    \expandafter\ltx@gobbletwo\SE@w
    \expandafter\SE@CarTwo\SE@a\@nil
  }%
  \edef\SE@w{%
    \SE@Nibbles@BinToHex\SE@w
  }%
  \SE@Add\SE@w{\expandafter"\SE@w}\ltx@one
  \ifnum\SE@w>15 %
    \def\SE@char{1}%
    \SE@Add\SE@w\SE@w{-16}%
  \else
    \def\SE@char{0}%
  \fi
  \edef\SE@w{\SE@Nibble@NumToBin\SE@w}%
  \edef\SE@temp{%
    0\SE@char
    \expandafter\SE@CarTwo\SE@w\@nil
    10%
    \expandafter\ltx@gobbletwo\SE@w
    \expandafter\ltx@gobbletwo\SE@a
    \expandafter\SE@CarTwo\SE@b\@nil
    10%
    \expandafter\ltx@gobbletwo\SE@b
    \expandafter\ltx@gobbletwo\SE@c
    \expandafter\SE@CarTwo\SE@d\@nil
    10%
    \expandafter\ltx@gobbletwo\SE@d
  }%
  \SE@ResultAdd{%
    F%
    \SE@Nibbles@BinToHex\SE@temp
    #8%
  }%
}
\expandafter\gdef\csname\SE@PrefixFrom utf8\endcsname#1{%
  \let\SE@temp\ltx@empty
  \let\SE@next\SE@utfviii@filter
  \expandafter\SE@utfviii@filter#1\relax\relax
  \ifcase\ifSE@TestMode
           \ifSE@invalid
             \ltx@one
           \else
             \ltx@zero
           \fi
         \else
           \ltx@zero
         \fi
    \expandafter\SE@utfviii@from\SE@temp\relax\relax\relax\relax
                                        \relax\relax\relax\relax
  \fi
}
\gdef\SE@utfviii@filter#1#2{%
  \ifx#1\relax
    \let\SE@next\relax
  \else
    \ifcase\ifnum"#1#2>"F4 %
             \ltx@zero
           \else
             \ifnum"#1#2="C0 %
               \ltx@zero
             \else
               \ifnum"#1#2="C1 %
                 \ltx@zero
               \else
                 \ltx@one
               \fi
             \fi
           \fi
      \SE@InvalidCharacter
      \ifSE@TestMode
        \let\SE@next\SE@SkipRemaining
      \fi
    \else
      \edef\SE@temp{\SE@temp#1#2}%
    \fi
  \fi
  \SE@next
}
\gdef\SE@utfviii@from#1#2#3#4#5#6#7#8{%
  \ifx#1\relax
    \let\SE@next\relax
  \else
    \ifnum"#1<8 % 0xxx xxxx
      \SE@ResultAdd{00#1#2}%
      \def\SE@next{\SE@utfviii@from#3#4#5#6#7#8}%
    \else
      \ifnum"#1<12 % 10xx xxxx
        \SE@InvalidCharacter
        \ifSE@TestMode
          \let\SE@next\SE@SkipRemaining
        \else
          \def\SE@next{\SE@utfviii@from#3#4#5#6#7#8}%
        \fi
      \else
        \ifx#3\relax
          \let\SE@next\relax
          \SE@InvalidCharacter
        \else
          \ifcase\SE@utfviii@CheckCont#3%
            \SE@InvalidCharacter
            \ifSE@TestMode
              \let\SE@next\SE@SkipRemaining
            \else
              \def\SE@next{\SE@utfviii@from#3#4#5#6#7#8}%
            \fi
          \else
            \ifnum"#1<14 % 110y yyyy 10xx xxxx
                         % 0000 0yyy yyxx xxxx
              \edef\SE@temp{%
                \SE@Nibble@NumToBin{"#3}%
              }%
              \edef\SE@temp{%
                0\ifodd"#1 1\else 0\fi
                \SE@Nibble@NumToBin{"#2}%
                \expandafter\ltx@gobbletwo\SE@temp
              }%
              \SE@ResultAdd{%
                0%
                \SE@Nibbles@BinToHex\SE@temp
                #4%
              }%
              \def\SE@next{\SE@utfviii@from#5#6#7#8}%
            \else
              \ifx#5\relax
                \let\SE@next\relax
                \SE@InvalidCharacter
              \else
                \ifcase\SE@utfviii@CheckCont#5%
                  \SE@InvalidCharacter
                  \ifSE@TestMode
                    \let\SE@next\SE@SkipRemaining
                  \else
                    \def\SE@next{\SE@utfviii@from#5#6#7#8}%
                  \fi
                \else
                  \ifnum"#1=14 % 1110 zzzz 10yy yyyy 10xx xxxx
                               % zzzz yyyy yyxx xxxx
                    \ifcase\ifnum"#2="D %
                             \ifnum"#3#4>"9F %
                               \ltx@zero
                             \else
                               \ltx@one
                             \fi
                           \else
                             \ifnum"#2=\ltx@zero
                               \ifnum"#3<"A %
                                 \ltx@zero
                               \else
                                 \ltx@one
                               \fi
                             \else
                               \ltx@one
                             \fi
                           \fi
                      \SE@InvalidCharacter
                      \ifSE@TestMode
                        \let\SE@next\SE@SkipRemaining
                      \else
                        \def\SE@next{\SE@utfviii@from#7#8}%
                      \fi
                    \else
                      \edef\SE@a{\SE@Nibble@NumToBin{"#3}}%
                      \edef\SE@b{\SE@Nibble@NumToBin{"#5}}%
                      \edef\SE@temp{%
                        \expandafter\ltx@gobbletwo\SE@a
                        \SE@Nibble@NumToBin{"#4}%
                        \expandafter\ltx@gobbletwo\SE@b
                      }%
                      \SE@ResultAdd{%
                        #2%
                        \SE@Nibbles@BinToHex\SE@temp
                        #6%
                      }%
                      \def\SE@next{\SE@utfviii@from#7#8}%
                    \fi
                  \else
                    \ifx#7\relax
                      \let\SE@next\relax
                      \SE@InvalidCharacter
                    \else
                      \ifcase\SE@utfviii@CheckCont#7%
                        \SE@InvalidCharacter
                        \ifSE@TestMode
                          \let\SE@next\SE@SkipRemaining
                        \else
                          \def\SE@next{\SE@utfviii@from#7#8}%
                        \fi
                      \else
                        \let\SE@next\SE@utfviii@from
                        \ifnum"#2<8 % 1111 0uuu 10uu zzzz 10yy yyyy 10xx xxxx
                                    % 1101 10ww wwzz zzyy 1101 11yy yyxx xxxx
                          \edef\SE@w{\SE@Nibble@NumToBin{"#3}}%
                          \edef\SE@w{%
                            00%
                            \SE@Nibble@NumToBin{"#2}%
                            \expandafter\ltx@gobbletwo\SE@w
                          }%
                          \edef\SE@w{\SE@Nibbles@BinToHex\SE@w}%
                          \SE@Add\SE@w{\expandafter"\SE@w}{-1}%
                          \ifnum\SE@w>15 %
                            \SE@InvalidCharacter
                            \ifSE@TestMode
                              \let\SE@next\SE@SkipRemaining
                            \fi
                          \else
                            \ifnum\SE@w<\ltx@zero
                              \SE@InvalidCharacter
                              \ifSE@TestMode
                                \let\SE@next\SE@SkipRemaining
                              \fi
                            \else
                              \edef\SE@a{\SE@Nibble@NumToBin{"#5}}%
                              \edef\SE@b{\SE@Nibble@NumToBin{"#7}}%
                              \edef\SE@temp{%
                                10%
                                \SE@Nibble@NumToBin\SE@w
                                \SE@Nibble@NumToBin{"#4}%
                                \expandafter\ltx@gobbletwo\SE@a
                                1101%
                                11%
                                \SE@Nibble@NumToBin{"#6}%
                                \expandafter\ltx@gobbletwo\SE@b
                              }%
                              \SE@ResultAdd{%
                                D%
                                \SE@Nibbles@BinToHex\SE@temp
                                #8%
                              }%
                            \fi
                          \fi
                        \else
                          \SE@InvalidCharacter
                          \if\SE@TestMode
                            \let\SE@next\SE@SkipRemaining
                          \fi
                        \fi
                      \fi
                    \fi
                  \fi
                \fi
              \fi
            \fi
          \fi
        \fi
      \fi
    \fi
  \fi
  \SE@next
}
\gdef\SE@utfviii@CheckCont#1{%
  \ifnum"#1<8 %
    \ltx@zero
  \else
    \ifnum"#1<12 %
      \ltx@one
    \else
      \ltx@zero
    \fi
  \fi
}
\endinput
%%
%% End of file `se-utf8.def'.
