# lstlistings: Regexp quotation mark/apostrophe error

I am attempting to display a long Python Regexp in LaTeX lstlistings. When compiling I get the following error message though.

! Package inputenc Error: Unicode char \u8:�\lst@FillFixed@\lst@EC� not set up for use with LaTeX.


I believe it is caused by the quote marks ' and ´. How do I correctly display them in lstlisting the simplest way possible? I am a LaTeX beginner, and have searched and tried many other solutions, however none has helped me.

\lstset{
language=Python,
basicstyle=\footnotesize,
captionpos=t,
texcl=true,
numbers=left,
numbersep=7pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
stepnumber=1,
breaklines=true,
}

\begin{lstlisting}[frame=single, caption=Full source code]

pattern_p = re.finditer("(\t|; )((\w{2,}( |-)?)+) ?($$(m|f|n)$$)? ?($$((\w{2,}\'?-?’?\?? ?)+)($$|,|’))?", decoded_line)

\end{lstlisting}

• (1) Welcome, (2) always post MWEs that are things we can (attempt to) compile. Here we do not know the preamble. Are you sure you are not looking for ' (the apostrophe) and  (sometimes called the back ping). Those are ascii chars. When I copy your text those are UTF8 chars. – daleif May 26 '15 at 11:32
• If I change those to ascii chars, then the code works fine. – daleif May 26 '15 at 11:35
• Yes, those are UTF-8 chars because they are the ones I'm looking for with the Regexp. – user2768479 May 26 '15 at 11:54
• listings does not like utf8 (it cannot handle 2bit chars very well). You might want to use literate in order to tell it how to handle those two chars. – daleif May 26 '15 at 12:09
• This at least compiles: literate={’}{}1 might want to use a different output symbol – daleif May 26 '15 at 12:13

\lstset{