# special characters not showing (mathexam+babel)

I am trying to edit a exam using a template I found on internet (article using mathexam package) but since I have to use special characters of Brazilian portuguese (like á, à, ç, ã, õ, ô, â, ê) my final .pdf was not showing how I intended. The characters do not appear on the output, after compiling, by simply typing them on the code like I do in most of my other .tex documents (using babel and inputec packages).

But when I created a new .tex and was editing it to add on the current question, it finally worked. I think it must have something to do with codification of the file, but I have no idea how to change that option on the files.

What was actually happening?

In my documents I always use \usepackage[latin1]{inputenc}. How can I know if some file has different codification, and how to change it properly?

***I work on TeXnicCenter under WIN7 system.

Below is the example:

\documentclass{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage[latin1]{inputenc}
\usepackage[brazil]{babel}
\usepackage[left=1in, right=1in, top=1in, bottom=1in]{geometry}
\usepackage{mathexam}

\ExamClass{Instituição}
\ExamName{Simplificação de Raízes}

\let\ds\displaystyle

\begin{document}
\ExamInstrBox{
Coment with á é ã ç, ....}
\ExamNameLine
\begin{enumerate}
\item Calc something1.
\begin{enumerate}
\item $\frac{\sqrt{x+1} - 2}{x-3}$\answer
\item $\frac{\sin(4x)}{8x}$\answer[1in plus 1fill]
\end{enumerate}
\item Calc something2
$\lim_{x\rightarrow 2} x^5 -2x^2 + 4x + -7 = 0$\noanswer[2.5in]
\item Find...
\answer*{$f(x)=$}\addanswer*{$g(x)=$}
\end{enumerate}
\end{document}

-
most editors will (somehow) show you the file encoding but I do not know that one. However if the file is not latin1 it is probably UTF-8 so changing the inputenc option to [utf8] will probably fix it –  David Carlisle May 17 '14 at 14:05

If your posted example is saved as iso-8859-1 (latin1) it runs without error and produces the expected result.

If it is saved as UTF-8 it produces

Spurious accented A are a sure sign that the multi-byte UTF-8 characters are being interpreted as latin-1.

There are tools to convert back to latin1, but Unicode is the future, so possibly a better option is to tell LaTeX that you are using utf-8

\usepackage[utf8]{inputenc}


-

\usepackage[T1]{fontenc}