Improved UTF-8 parsing