Added support for text encoding