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.
Best Answer
Yes you can replace the faulty char. You could replace
°
with\ensuremath{^\circ}
or add to your latex header:
Or you could use
xelatex
then there is no need for\usepackage[utf8]{inputenc}
because it has fullutf8
support build in.The encoding is all right Latex just doesn't know what to do with the unicode symbol
:D