improve user defined format for Encode