The aim is to generate the .pdf with accented characters (the .tex file has mixed macro and unicode input), in a way that the .pdf text can be copy-pasted.
An example:
\documentclass{article}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tgpagella}
\begin{document}
Unicode input: ā ī ū ṃ ṅ ñ
Macro input: \=a \={\i} \=u \d{m} \.n \~n
\end{document}
Compiling with pdflatex, the above will visually produce the desired characters, but when you select and copy-paste them from the .pdf, you get
Unicode input: a ̄ u m n ñ
̄ı ̄ . ̇
Macro input: a ̄ u m n ñ
Edit:
Ulrike's answer explains what pdflatex is doing here.