Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,10 @@
|
|||
fn main() {
|
||||
let chars = vec!('A', 'ö', 'Ж', '€', '𝄞');
|
||||
chars.iter().for_each(|c| {
|
||||
let mut encoded = vec![0; c.len_utf8()];
|
||||
c.encode_utf8(&mut encoded);
|
||||
let decoded = String::from_utf8(encoded.to_vec()).unwrap();
|
||||
let encoded_string = encoded.iter().fold(String::new(), |acc, val| format!("{}{:X}", acc, val));
|
||||
println!("Character: {}, Unicode:{}, UTF-8 encoded:{}, Decoded: {}", c, c.escape_unicode(), encoded_string , decoded);
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue