Trying to include a source-file into my latex document using the listings package, i got problems with german umlauts inside of the comments in the code. Using
\lstset{
extendedchars=\true,
inputencoding=utf8x
}
Umlauts in the source files (encoded in UTF-8 without BOM) are processed, but they are somehow moved to the beginning of the word they are contained in. So
// die Größe muss berücksichtigt werden
in the input source file, becomes
// die ößGre muss übercksichtigt werden
in the output file.
NOTE: since i found errors in my initial setup, i heavily edited this question
ok, found kinda workaround now:
instead of listings package, use listingsutf8
\usepackage{listingsutf8}
copy listings.sty to the folder the document resides
find the following lines
\lst@CCPutMacro \lst@ProcessOther {"23}\# \lst@ProcessLetter{"24}\textdollar \lst@ProcessOther {"25}\% \lst@ProcessOther {"26}\&
Enter there the following lines (each "registers" one umlaut)
\lst@ProcessLetter{"E4}{\"a} \lst@ProcessLetter{"F6}{\"o} \lst@ProcessLetter{"FC}{\"u} \lst@ProcessLetter{"C4}{\"A} \lst@ProcessLetter{"D6}{\"O} \lst@ProcessLetter{"DC}{\"U} \lst@ProcessLetter{"DF}{\ss{}}
Save the file
Use
\lstset{ extendedchars=\true, inputencoding=utf8/latin1 }
to enable utf8 character to latin1 character mapping
I know this is ugly in many way, but its the only solution that works for me so far.