add string encoding method