More character encoding experiments. Still not perfect, but mostly
better.