handle encoding problems database logging