Ensure charset is maintained when serializing as YAML