Fix generate encode_name if name is empty.