The true culprit ended up being Nokogiri, not Liquid. Nokogiri is used to parse and manipulate the HTML that will eventually go through Liquid. During Nokogiri's time with the HTML, however, it was confusing the encoding (particularly when using doc.replace
), and thus screwing up the special characters.
Relevant question and answer to this specific problem (I ended up using the solution from the second link below):