Better encoding handling in title parsing

Thanks to a patch from Le Hollandais Volant.