I am trying to insert a listing in LyX in an enumeration ("\item ..."). My document is in French, with UTF8-encoding for the accents. However, when I click on the button "Program listing" in the Insert menu, LyX adds to the latex code:
\inputencoding{latin9}
\begin{lstlisting}
\end{lstlisting}
\inputencoding{utf8}
When I try to compile, it failed if I had accents in the document after the code listing ("The control sequence marked should not appear between \csname and \endcsname.")
However, if I insert manually (Ctrl+L) just the environment lstlisting (or even just lstinline, which is my objective) without any encoding option, it compiles perfectly, but it doesn't look as some code in LyX.
What can I do? Indeed, I would like to have the nice look of the code in LyX.
Thank you.
The log: https://pastebin.com/TBvd7vqS
The minimal .lyx file: https://pastebin.com/42cBkzdx
The .tex produced: https://pastebin.com/gyDef1Uj