Entities to string encoding