In UTF-8 it should be possible to use ä and ö.
But actually in my code listing I use the package listings I receive by this example
\lstset{language=HTML}
% Set your language (you can change the language for each code-block optionally)
\begin{lstlisting}[caption=Socket Connection, frame=single] % Start your code-block
// einbinden der Library mittels CommonJs
var net = require('net');
// Socket Client erstellen
var client = new net.Socket();
// mit dem Server verbinden IP Port angeben
client.connect(<PORT>, '<IP>', function() {
console.log('Connected');
client.write('Hello, server! Love, Client.');
});
// verschiedene Events Listener
// dieser wird ausgelöst s der Server Daten zum Client sendet
client.on('data', function(data) {
console.log('Received: ' + data);
client.destroy(); // kill client after server's response
});
client.on('close', function() {
console.log('Connection closed');
});
\end{lstlisting}
the error message
! Package inputenc Error: Invalid UTF-8 byte sequence.
And it is denoting to the line with the 'ö' // dieser wird ausgelöst s der Server Daten zum Client sendet
Note: Sure I know it isn't HTML but when I say JavaScript it doesn't work
In the preamble I say
\usepackage[utf8]{inputenc} % Unicode Text
literateto add non-ascii to listings parsing, see also https://tex.stackexchange.com/a/411536/3929 – daleif Mar 12 '21 at 08:27