Remove unsued buffer and added utf-8 support