Skip to content

Commit

Permalink
Remove Encoding enum variant UTF16
Browse files Browse the repository at this point in the history
During testing, I could not get UTF16 to work
properly, even on master.
I removed the option to store UTF16 BOM in
EncodingBom.
  • Loading branch information
Alexis-Lapierre committed Apr 4, 2023
1 parent 39bb397 commit aacf4e3
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions helix-view/src/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@ pub struct SavePoint {
#[derive(Debug, Clone)]
pub enum EncodingBom {
UTF8,
UTF16BE,
UTF16LE,
NoBom(&'static Encoding),
}

Expand All @@ -135,8 +133,6 @@ impl EncodingBom {
fn encoding(&self) -> &'static Encoding {
match self {
EncodingBom::UTF8 => encoding::UTF_8,
EncodingBom::UTF16BE => encoding::UTF_16BE,
EncodingBom::UTF16LE => encoding::UTF_16LE,
EncodingBom::NoBom(encoding) => encoding,
}
}
Expand All @@ -146,10 +142,6 @@ impl EncodingBom {
fn for_bom(encoding: &'static Encoding) -> Self {
if encoding == encoding::UTF_8 {
EncodingBom::UTF8
} else if encoding == encoding::UTF_16BE {
EncodingBom::UTF16BE
} else if encoding == encoding::UTF_16LE {
EncodingBom::UTF16LE
} else {
EncodingBom::NoBom(encoding)
}
Expand All @@ -165,18 +157,6 @@ impl EncodingBom {
buf[2] = 0xbf;
3
}
EncodingBom::UTF16BE => {
buf[0] = 0xfe;
buf[1] = 0xff;
2
}

EncodingBom::UTF16LE => {
buf[0] = 0xef;
buf[1] = 0xff;
2
}

EncodingBom::NoBom(_) => 0,
}
}
Expand Down

0 comments on commit aacf4e3

Please sign in to comment.