What should I put in the preamble (preferably packages) for this to work as expected with its unicode characters?
\documentclass{article}
\usepackage{listings}
\begin{document}
$α$ α
\begin{lstlisting}
α = 1.;
\end{lstlisting}
\end{document}
Note that alpha (α) appears in three contexts: as text, as math and as code (listings).
(I can use lualatex if it simplifies things)
For a higher challenge, in this case I introduce a second level of difficulty, by introducing a second kind of alpha (: 0x1d6fc Mathematical italic small alpha vs. α: Greek small letter alpha). To see to what degree TeX can deal with the nuance (e.g. by make into $\alpha$, or by making --0x1D45D Mathematical italic small p-- into $p$):
\documentclass[]{article}
\usepackage[]{listings}
\begin{document}
$α$ α $$
\begin{lstlisting}
α = 1.
= 2.
\end{lstlisting}
\end{document}

listingscan only handle single byte chars plus stuff that can be represented in latin1. So someone has to write a fully utf8 aware version oflistings– daleif Oct 03 '13 at 07:29