goalng encode snippet