Fix document encoding.