The code below is generated by LyX. I trimmed down the original in order to make a MWE. No matter what I do with this, I keep getting an error message when the file tries to compile with pdflatex.
\documentclass[oneside,english,oldfontcommands,oneside, article,
extrafontsizes, 10pt, latin9, utf8, main=american]{memoir}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage[utf8]{inputenc}
\DeclareUnicodeCharacter{200B}{\hspace{0pt}} % This works
%\DeclareUnicodeCharacter{CC}{\"a} % Neither this
\DeclareUnicodeCharacter{00E4}{\"a} % nor this works.
\begin{document}
This is a trägar. Hello world. Goodbye.
\end{document}
I would attach the log if I knew how. But this is the relevant part:
! Package inputenc Error: Unicode char äga (U+CC)
(inputenc) not set up for use with LaTeX.
See the inputenc package documentation for explanation.
Type H <return> for immediate help.
...
l.12 This is a träga
r. Hello world. Goodbye.
latin9, utf8on the top line, the file can not be in both encodings, is it latin9 encoded? If so the unicode declarations will not work. The file is certainly in some encoding other than UTF-8, note how it has taken äga as three bytes of a single character as it is trying to read the document as multi-byte utf-8 – David Carlisle Feb 28 '18 at 00:08