Add encode_opt() to choose native or escaped utf8 code