Encode and decode as needed so we don't write invalid XML, define a var.