Client encoding in JS API