Deal with encoding problems that showed up after switching to lxml.