Command \texteuro unavailable in encoding T1

With utf8 the Unicode character is mapped to \texteuro, which requires textcomp. The definition of \texteuro is

\DeclareTextCommandDefault{\texteuro}
   {\CheckEncodingSubset\UseTextSymbol{TS1}\tc@fake@euro5\texteuro}

If the TS1 font for the current family is known not to have the Euro symbol (that is, it belongs to class 5), the glyph is faked by means of \tc@fake@euro. If you want instead to raise an error, just change the definition of this macro:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{textcomp}

\makeatletter
\def\tc@fake@euro#1{%
  \@latex@error{No \noexpand#1in family \f@family}{}%
}
\makeatother

\begin{document}
X€X

\fontfamily{put}\selectfont % put belongs to class 5
X€X
\end{document}

This will issue

! LaTeX Error: No \texteuro in family put.

and no glyph will be printed. You could define it to use a glyph from another font instead, say

\def\tc@fake@euro#1{{%
  \fontencoding{TS1}\fontfamily{lmr}\selectfont\symbol{191}%
}}

Note that a test based on \iffontchar\font191 will not succeed, because usually fonts built with fontinst have a black square for inexistent characters. Therefore textcomp bases its decision to fake or not a glyph on an internal database.


By the way, \iffontchar\font"1E9E will return false if eight bit TeX fonts are used, so it's a pretty useless test.


LaTeX does not need to check anything, the T1 encoding doesn't include euro by definition. It is in the TS1 encoding (as used by textcomp) and of course in the EU1 and EU2 encodings used by lua and xe latex.