<!-- 
.. title: Integrity check
.. slug: integrity-check
.. date: 2011-08-09 20:59:33 UTC+01:00 
.. tags: linux, latex, 
.. link: 
.. description: 
.. type: text 
--> 

Now I got this [super-bibliography](sed-rules.html "super-bibliography") with thousands of entries and want to know if all entries are ok, or if one contains a weird character which is displayed incorrectly or even inhibits a successful compilation by LaTeX/BibTeX. How do I do that? Probably the easiest way is to run the following LaTeX file

	\documentclass{amsart}
	\usepackage[T1]{fontenc}
	\usepackage[utf8]{inputenc}
	\begin{document}
	\nocite{*}
	\bibliographystyle{amsplain}
	\bibliography{bibliography}
	\end{document}

through the following script:

	#!/bin/bash

	charset=$(file -bi bibliography.bib | awk '{print $2}')

	if [ $charset == charset=utf8 ]; then
	  echo "Encoding ok"
	else
	  echo "Non UTF character detected"
	fi

	errors=$(rubber --pdf --quiet biblist.tex 2>&1)
	if [ -z "$errors" ]; then
	  echo "Compilation successful"
	else
	  echo "Compilation failed"
	  echo $errors
	fi

	rubber --pdf --clean biblist.tex

