Crates.io | ebcdic |
lib.rs | ebcdic |
version | 0.1.2 |
source | src |
created_at | 2017-11-22 17:05:39.842167 |
updated_at | 2017-11-22 17:33:48.114622 |
description | Library to convert EBCDIC to ASCII and back |
homepage | https://github.com/rohitjoshi/ebcdic-rs |
repository | https://github.com/rohitjoshi/ebcdic-rs |
max_upload_size | |
id | 40246 |
size | 26,109 |
#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());
}