I am using LaTeX in a portuguese document, with special characters such as tilde or cedilla. I have a sample document with the following content:
\documentclass{book}
\usepackage[utf8]{inputenc}
\begin{document}
é canção
\end{document}
My editor (TeXworks) is configured to use UTF8, and the resultant PDF shows the right result, as seen on the following image:

My problem is: when I copy the text from the PDF I get weird characters, and not the text that is exhibited. How to overcome this?
Thanks.
\usepackage[T1]{fontenc}for XeLaTeX or LuaLaTeX ● that solution only works for characters that is actually included in T1 encoding, so for exampleṃwill still not work, refer to this for a solution. ● another related question – user202729 Dec 21 '23 at 09:09