Fixes for UTF-8 encoding in 8-bit mode