encode chat text