Struct jomini::Windows1252Encoding
source · pub struct Windows1252Encoding;
Expand description
Decodes bytes according to the windows1252 code page
use jomini::{Windows1252Encoding, Encoding};
let encoding = Windows1252Encoding::new();
assert_eq!(encoding.decode(b"Common Sense"), "Common Sense");
assert_eq!(
encoding.decode(b"\xa7GRichard Plantagenet\xa7 ( 2 / 4 / 3 / 0 )"),
"§GRichard Plantagenet§ ( 2 / 4 / 3 / 0 )"
);
assert_eq!(encoding.decode(br#"Captain \"Joe\" Rogers"#), r#"Captain "Joe" Rogers"#);
assert_eq!(encoding.decode(b"1444.11.11\n"), "1444.11.11");
assert_eq!(encoding.decode(b"\xff"), "ÿ");
assert_eq!(encoding.decode(b"\x8a"), "Š");
assert_eq!(encoding.decode(b"\xfe\xff\xfe\xff\xfe\xff\xfe\xff\xfe\xff"), "þÿþÿþÿþÿþÿ");
assert_eq!(encoding.decode(b"hi\x81\x8a"), "hi\u{81}Š");
Implementations§
Trait Implementations§
source§impl Clone for Windows1252Encoding
impl Clone for Windows1252Encoding
source§fn clone(&self) -> Windows1252Encoding
fn clone(&self) -> Windows1252Encoding
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for Windows1252Encoding
impl Debug for Windows1252Encoding
source§impl Default for Windows1252Encoding
impl Default for Windows1252Encoding
source§fn default() -> Windows1252Encoding
fn default() -> Windows1252Encoding
Returns the “default value” for a type. Read more