From 119f9200692c21adf31c28a35a4ed45fef6e3826 Mon Sep 17 00:00:00 2001 From: mirabilos <m@mirbsd.org> Date: Sun, 5 Aug 2018 05:01:27 +0200 Subject: [PATCH] show _which_ byte string is wrong, in hex --- unicodedomino.sty | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/unicodedomino.sty b/unicodedomino.sty index 3b4d13f..fb5cb8d 100644 --- a/unicodedomino.sty +++ b/unicodedomino.sty @@ -120,6 +120,15 @@ \the\numexpr\decode@UTFviii#2\relax})% }% +% for invalid encoding output +\gdef\unicodedomino@splith@x#1#2\relax{% + \space 0x\UTFviii@hexnumber{`#1}% + \ifx\relax#2\relax\else\unicodedomino@splith@x#2\relax\fi% +}% +\gdef\unicodedomino@splithex#1:#2\relax{% + \unicodedomino@splith@x#2\relax% +}% + % render the actual domino piece \def\unicodedomino@box#1#2{% \begingroup% @@ -214,8 +223,10 @@ \fi% \else% % invalid encoding - \PackageError{inputenc}{Invalid UTF-8 byte sequence}% - {Do ensure the source document is saved in UTF-8 encoding.}% + \PackageError{inputenc}{% + Invalid\space UTF-8\space byte\space sequence:% + \expandafter\unicodedomino@splithex\string#1\relax% + }{Do ensure the source document is saved in UTF-8 encoding.}% \fi% \else% % known char, expand -- GitLab