I'm trying to import some logs files using \verbatiminput to do a automatic report from our logs. I got some encoding problem.
My objective: import some logs files with various special char (included hidden one) as verbatim.
- I believed the file to be in ISO-8859-1. (the server OS is windows)
- I got a LOT of file. So the usual solution "rewrite it"/"look for the faulty char" is not an option.
- I run pdflatex from a mac osx.
- I converted the files with (notice the -c option to drop faulty char)
.
for file in ./test*/*.txt
do
iconv -c -f ISO-8859-1 -t utf8 $file > $file.n1
mv -f $file.n1 $file
done
My tex header:
\usepackage{verbatim}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
error message I got :
! Package inputenc Error: Unicode char \u8:° not set up for use with LaTeX.
To solve the "degree" problem, I added
cat $file.n1 | tr '°' 'º' > $file.n2
then I got an other error on an other file, this time with an invisible char.
! Package inputenc Error: Unicode char \u8: not set up for use with LaTeX.
I first tried to not convert the file and import them as T1/latin1 or LY1/ascinew, but I got the error
! Package inputenc Error: Keyboard character used is undefined
(inputenc) in inputencoding `latin1'.
on different files.
My question:
- Is there a way to ignore/replace ALL the faulty char?
- from LaTeX ? from the shell ?
- using "tr" or "iconv" ?
- Am I doing something wrong when importing the files / doing the conversion?
- with which encoding will I have less problem ?
any help is welcome, as I am blocked on this since two days.
PS: My problem is not with the degree symbole in particular, but with unicode char that LaTeX cannot printout.
\usepackage[utf8]{inputenc}you are lying to LaTeX - and LaTeX doesn't like lies ;-). But you shouldn't remove inputenc completly (unless you are using an unicode engine like xetex). If you do it non-ascii-chars will only work partly. Load inputenc with the correct option (your encoding), and if you load files with another encoding than tell this LaTeX with the\inputencodingcommand. – Ulrike Fischer Jan 04 '12 at 15:29