Listings in Latex with UTF-8 (or at least german umlauts)

Posted by Janosch on Stack Overflow See other posts from Stack Overflow or by Janosch
Published on 2009-07-12T15:41:16Z Indexed on 2010/05/28 13:22 UTC
Read the original article Hit count: 326

Filed under:
|
|
|
|

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

© Stack Overflow or respective owner

Related posts about encoding

Related posts about latex