updated depreciated character encoding method