Bulletproof utf-8 encoding.