I tried to write some strings in an external file for use in a special type of index, but using utf8 accented characters appear wrong.
In my external file, those characters appear in the same way as I wrote in my document and thess characters can't be read later.
My test code is:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[portuges]{babel}
\usepackage[T1]{fontenc}
\newif\iffirstSiglaUse\firstSiglaUsetrue
\newcommand{\sigla}[2]{%
\iffirstSiglaUse
\newwrite\arqEscreveSiglas%
\immediate\openout\arqEscreveSiglas=\jobname.losg%
\firstSiglaUsefalse
\fi
\immediate\write\arqEscreveSiglas{#1 #2}%
#2 (#1)%
}
\AtEndDocument{%
\iffirstSiglaUse\else\immediate\closeout\arqEscreveSiglas\fi
}
\makeatletter
\newcommand{\leArquivo}{%
\def\dados{}
\newread\arqLeSiglas%
\openin\arqLeSiglas=\jobname.losg%
\loop\unless\ifeof\arqLeSiglas%
\read\arqLeSiglas to \dados%
\dados\par%
\repeat%
\closein\arqLeSiglas%
}
\begin{document}
\leArquivo
A \sigla{EPUSP}{Escola Politécnica da Universidade de Sao Paulo} é uma instituição de ensino ligada à \sigla{USP}{Universidade de Sao Paulo} e visa o ensino em engenharia. A entidade representativa dos engenheiros formado na EPUSP é responsabilidade da \sigla{AEP}{Associacao dos Engenheiros Politecnicos} que promove a integração entre ex-alunos.
\end{document}
The answer is "! Package inputenc Error: Unicode char \u8:(something) not set up for use with LaTeX"
I read the inputenc documentation and I saw some aux files generated using utf8 characters and I realized that the correct representation of accented characters is "\IeC{...}", but my output file is not so.
My output file is:
EPUSP Escola Politécnica da Universidade de Sao Paulo
USP Universidade de Sao Paulo
AEP Associacao dos Engenheiros Politecnicos
Does anyone know what I did wrong?
\openin\arqLeSiglas=\jobname.losg%
should be better\openin\arqLeSiglas=\jobname.losg
. Here the space produced by the end of line works as file name terminator and is then removed. You actually want this in this case.