auto encode for unicode