I can't add uppercase string in cyrillic into table of contents in my bi-lingual document. Here is a compilable example:
\documentclass[a4paper,10pt]{extreport}
\usepackage[koi8-r]{inputenc}
\usepackage[english,russian]{babel}
\newif\ifeng
\def\rus{\selectlanguage{russian}\engfalse}
\def\eng{\selectlanguage{english}\engtrue}
\def\UpperCase#1{\ifeng\uppercase{#1}\else\lowercase{#1}\fi}
\def\section#1{\vspace{1cm plus 1cm minus .5cm}\goodbreak
\noindent{\bf\large\UpperCase{#1}}%
\ifeng\addcontentsline{entoc}{section}{\UpperCase{#1}}\else%
\addcontentsline{rutoc}{section}{\UpperCase{#1}}\fi\par\nopagebreak
}
\def\subsection#1{\goodbreak
\noindent{\bf\large #1}%
\ifeng\addcontentsline{entoc}{subsection}{#1}\else%
\addcontentsline{rutoc}{subsection}{#1}\fi\par\nopagebreak}
\makeatletter
\renewcommand\tableofcontents{\pagebreak\selectlanguage{russian}
\noindent{\bf\large СОДЕРЖАНИЕ}\@starttoc{rutoc}
\vspace{2em}\selectlanguage{english}
\noindent{\bf\large CONTENTS}\@starttoc{entoc}}
\makeatother
\begin{document}
\tableofcontents
\rus\section{Русский}
\subsection{Подсекция}
Текст
\eng\section{English}
\subsection{Subsection}
Text
\end{document}
(It is strange, but to make uppercase in koi8-r I need call macro \lowercase and vice versa).
But on command \rus\section{Русский} in file \jobname.rutoc I see \contentsline {section}{\lowercase {\IeC {\CYRR }\IeC {\cyru }\IeC {\cyrs }\IeC {\cyrs }\IeC {\cyrk }\IeC {\cyri }\IeC {\cyrish
rt }}}{1}.
What should I do to get right uppercase in table of contents?

\MakeUppercaseand\MakeLowercase, not\uppercaseand\lowercase. – egreg Feb 11 '16 at 11:52koi8-r? – egreg Feb 11 '16 at 12:37