3 releases
Uses old Rust 2015
0.1.2 | Nov 22, 2017 |
---|---|
0.1.1 | Nov 22, 2017 |
0.1.0 | Nov 22, 2017 |
#1970 in Encoding
87 downloads per month
15KB
647 lines
#ebcdic-rs
It provides methods to convert ebcsic to ascii and back.
extern crate ebcdic;
use std::str;
use ebcdic::Ebcdic;
fn main() {
let ascii_str = " IDENTIFICATION DIVISION. 00000010";
let mut ebcdic_bytes: [u8; 80] = [0; 80];
Ebcdic::ascii_to_ebcdic(ascii_str.as_bytes(), &mut ebcdic_bytes, 80, true);
let mut ascii_str_2: [u8; 80] = [0; 80];
Ebcdic::ebcdic_to_ascii(&ebcdic_bytes, &mut ascii_str_2, 80, false, true);
assert_eq!(ascii_str, str::from_utf8(&ascii_str_2).unwrap());
}