encode attributes that are of unicode type