Make pdf module work & fully complete; also fix many encoding errors:

Documents may have different encodings (latin1/utf8/other).  Previously
non-ascii characters were stripped in the tika modules.  This caused no errors
but silently corrupted the content.  Now if we disabled stripping, MySQLdb.escape_string
would throw errors, unless we converted the string to utf8.  But converting
a string to utf8 is not possible if it is in an already different encoding
(throws errors again).  To fix this problem; we used parametrised statements
and perform no conversions.  This works only if the uforia database uses the
utf8 charset, but that is a reasonable requirement.