From b9db5f38e53a37f37ae92e32607fbbcd0e878819 Mon Sep 17 00:00:00 2001 From: mirabilos <m@mirbsd.org> Date: Sun, 5 Aug 2018 03:20:01 +0200 Subject: [PATCH] check for correct encoding inspired by upstream change between TL 2016 and 2018 --- unicodedomino.sty | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/unicodedomino.sty b/unicodedomino.sty index a0835fe..0d43411 100644 --- a/unicodedomino.sty +++ b/unicodedomino.sty @@ -196,20 +196,26 @@ % main handler \def\UTFviii@defined#1{% \ifx#1\relax% - % unknown char - \ifx\protect\@typeset@protect% - % not protected - \PackageWarning{inputenc}{% - Unicode\space char\space\expandafter\UTFviii@splitcsname\string#1\relax% - \space not\space set\space up\space for\space use\MessageBreak with\space% - LaTeX, replacing% - }% - % note: same warning as in \UTFviii@undefined@err in utf8.def v1.2c, - % except adding “, replacing†at the end and not being an error - \expandafter\unicodedomino@decode\string#1\relax% + \if\relax\expandafter\UTFviii@checkseq\string#1\relax\relax% + % unknown char + \ifx\protect\@typeset@protect% + % not protected + \PackageWarning{inputenc}{% + Unicode\space char\space\expandafter\UTFviii@splitcsname\string#1\relax% + \space not\space set\space up\space for\space use\MessageBreak with\space% + LaTeX, replacing% + }% + % note: same warning as in \UTFviii@undefined@err in utf8.def v1.2c, + % except adding “, replacing†at the end and not being an error + \expandafter\unicodedomino@decode\string#1\relax% + \else% + % protected, just write the original character + \expandafter\@gobblefour\string#1% + \fi% \else% - % protected, just write the original character - \expandafter\@gobblefour\string#1% + % invalid encoding + \PackageError{inputenc}{Invalid UTF-8 byte sequence}% + {Do ensure the source document is saved in UTF-8 encoding.}% \fi% \else% % known char, expand -- GitLab