I have a code snippet that uses the unicode character ’ (u2019), also known as right single quotation mark in the middle of a word. Unfortunately, it seems the lstlistings environment causes this character to behave oddly, along with the other quotation marks (u2018, u201c, u201d). It causes them to be moved to the beginning of whatever word they are in. The source code for the image below is

\documentclass[
]{article}
\usepackage{listings}
\begin{document}
\begin{lstlisting}[language=Python]
"It’s a be”auti“ful day in the nei‘borhood"
\end{lstlisting}
It’s a be”auti“ful day in the nei‘borhood
\end{document}
and I would have expected it to generate roughly similar things for both in and out of the code snippet, but for whatever reason lstlisting makes the quotations move to the beginning of the word they interrupt. I am using xelatex.
