added javascript encoder functionality