Reading and writing data in UTF-8 encoding