extern crate utf_16_to_utf_8; use utf_16_to_utf_8::utf_16_to_utf_8::*; fn main() { let input_1: [u16; 5] = [0xFEFF, 0x0001, 0x0002, 0x0003, 0x00A9]; let input_2: [u16; 5] = [0xFEFF, 0x0001, 0x0002, 0x0003, 0x00A9]; let input_3: [u16; 5] = [0xFFFE, 0x0100, 0x0200, 0x0300, 0xA900]; let mut output_count: usize = 0; let mut output: [u8; 15] = [0; 15]; let mut i: usize = 0; if utf_16_to_utf_8(&input_1, &mut output_count, &mut output) == true { while i != output_count { println!("0x{:02X}", output[i]); i += 1; } } println!(""); if utf_16_be_to_utf_8(&input_2, &mut output_count, &mut output) == true { i = 0; while i != output_count { println!("0x{:02X}", output[i]); i += 1; } } println!(""); if utf_16_le_to_utf_8(&input_3, &mut output_count, &mut output) == true { i = 0; while i != output_count { println!("0x{:02X}", output[i]); i += 1; } } }