I try to write some cyrillic text in a source code block:
\begin{lstlisting}[caption={asdfa},label={lst:tokens},language=SQL]
SELECT
(SELECT COUNT(*)
FROM cards
WHERE description ILIKE '%#НОМЕР#%') AS PhoneNumber,
(SELECT COUNT(*)
FROM cards
WHERE description ILIKE '%#ГОС.НОМЕР#%') AS LicensePlateNumber
\end{lstlisting}
style is set like below:
\lstset{
language=SQL,frame=ltrb,framesep=5pt,basicstyle=\normalsize,
keywordstyle=\ttfamily\color{OliveGreen},
identifierstyle=\ttfamily\color{CadetBlue}\bfseries,
commentstyle=\color{Brown},
stringstyle=\ttfamily,
showstringspaces=true,
escapeinside={<--}{-->},
extendedchars=\true,
literate={а}{\cyra}1
{б}{{\selectfont\char225}}1
{в}{{\selectfont\char226}}1
{г}{{\selectfont\char227}}1
{д}{{\selectfont\char228}}1
{е}{{\selectfont\char229}}1
{ё}{{\"e}}1
{ж}{{\selectfont\char230}}1
{з}{{\selectfont\char231}}1
{и}{{\selectfont\char232}}1
...
}
None of the cyrillic characters is displayed. I tried to enclose cyrillic in rare used characters (Listing with mixed english and russian symbols in comments), but it didn't work either. Usage of extendedchars=true instead of \true (Why does utf8 not allow Cyrillic letters in listings when utf8x does?) doesn't help. I've found suggestion to use mintex (the first link), but I will have to create a list of listings.
I also have following imports at the beginning:
\usepackage[utf8]{inputenc}
\usepackage[russian, english]{babel}
Use of polyglossia with Russian as an additional language didn't help as well.
How can I make this thing work with cyrillic symbols?
Edit: Here are the imports:
\documentclass[a4paper,12pt]{report}
\usepackage{graphicx}
\graphicspath{pics/}
\usepackage[a4paper,top=25mm,bottom=25mm]{geometry}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyfoot{}
\fancyfoot[R]{\thepage}
\fancypagestyle{plain}{}
\usepackage[nottoc]{tocbibind}
\usepackage[utf8]{inputenc}
\usepackage[russian, english]{babel}
\usepackage{url}
\usepackage{xurl}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{float}
\usepackage{wrapfig}
\usepackage{indentfirst}
\usepackage{mathtools}
\usepackage{hyperref}
\usepackage{enumitem}
\usepackage[acronym,automake]{glossaries}
\usepackage{xcolor,listings}
\usepackage{fontspec}
\usepackage[T2A]{fontenc}
\setmonofont{Courier New}
\input{common/lststyles}
None of the packages are applied after this.
Edit 2: This sample code works, although in a weird manner:
\lstdefinestyle{code-style-sql}{
belowcaptionskip=1\baselineskip,
xleftmargin=\parindent,
identifierstyle=\color{blue},
language=SQL, % the language of the code
backgroundcolor=\color{backgray}, % choose the background color; you must add \usepackage{color} or \usepackage{xcolor}; should come as last argument
commentstyle=\color{codegray}, % comment style
keywordstyle=\color{codeblue}\bfseries, % keyword style
numberstyle=\tiny\color{codegray}, % the style that is used for the line-numbers
stringstyle=\color{codeblue}, % string literal style
basicstyle=\small\ttfamily\footnotesize, % Размер и тип шрифта, the size of the fonts that are used for the code
breakatwhitespace=false, % sets if automatic breaks should only happen at whitespace
breaklines=true, % Перенос строк, the size of the fonts that are used for the code
captionpos=lt, % sets the caption-position to bottom
keepspaces=true, % keeps spaces in text, useful for keeping indentation of code (possibly needs columns=flexible)
numbers=left, % where to put the line-numbers; possible values are (none, left, right)
numbersep=5pt, % how far the line-numbers are from the code
stepnumber=1, % the step between two line-numbers. If it's 1, each line will be numbered
showspaces=false, % show spaces everywhere adding particular underscores; it overrides 'showstringspaces'
showstringspaces=false, % underline spaces within strings only
showtabs=false, % show tabs within strings adding particular underscores
tabsize=2, % Размер табуляции, sets default tabsize to 2 spaces
% frame=single, % Рамка, adds a frame around the code
% frame=TB,
literate={--}{{-{}-}}2, % Корректно отображать двойной дефис
literate={---}{{-{}-{}-}}3, % Корректно отображать тройной дефис
escapeinside={<--}{-->}
}
\lstset{style=code-style-sql}
It moves cyrillic text to the left apostrophe and leaves the signs at the right side: 'ГОСНОМЕР%#.#%' instead of '%#ГОС.НОМЕР#%'.

\documentclass{...}and ending with\end{document}. – DG' Jul 15 '20 at 07:29{б}{{\selectfont\char225}}are incorrect. There might originally have been a\fontencoding{T2A}before\selectfontin a document for PDFTeX. However, a document in XeTeX should just use Unicode. – Davislor Dec 12 '20 at 18:08