PANDOC + encoding-guessing.