Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# Unreleased

## Features

- Add Unicode Control Pictures block Character Table


# v0.17.0

## Features
Expand Down
13 changes: 12 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ pub enum CharacterTable {

/// Uses braille characters for non-printable bytes.
Braille,

/// Uses Unicode Control Pictures Block and '×' for non-ASCII bytes
/// Not all monospace fonts support this
#[value(name = "unicode")]
UnicodeControlPictures,
}

#[derive(Copy, Clone, Debug, Default, ValueEnum)]
Expand Down Expand Up @@ -184,6 +189,12 @@ impl Byte {
char::from_u32(0x2800 + to_braille_bits(self.0) as u32).unwrap()
}
},
CharacterTable::UnicodeControlPictures => match self.category() {
AsciiPrintable => self.0 as char,
NonAscii => '×',
_ if self.0 == 0x7F => '\u{2421}', // DEL
_ => char::from_u32(self.0 as u32 + 0x2400).unwrap(),
},
}
}
}
Expand Down Expand Up @@ -852,7 +863,7 @@ impl<'a, Writer: Write> Printer<'a, Writer> {
}

/// Print the bytes in C include file style
/// Return the number of bytes read
/// Return the number of bytes read
fn print_bytes_in_include_style<Reader: Read>(
&mut self,
buf: &mut BufReader<Reader>,
Expand Down
Loading