Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--Cargo.lock4
-rw-r--r--helix-view/Cargo.toml2
-rw-r--r--helix-view/src/document.rs8
3 files changed, 9 insertions, 5 deletions
diff --git a/Cargo.lock b/Cargo.lock
index b0809d16..edbf24a8 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -134,9 +134,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "chardetng"
-version = "0.1.17"
+version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "14b8f0b65b7b08ae3c8187e8d77174de20cb6777864c6b832d8ad365999cf1ea"
+checksum = "13de944a44b5064ee5d3a5ceccc49a41bfec50f2580e66f82e87703acdb88b53"
dependencies = [
"cfg-if",
"encoding_rs",
diff --git a/helix-view/Cargo.toml b/helix-view/Cargo.toml
index 4d33eaf2..eb958747 100644
--- a/helix-view/Cargo.toml
+++ b/helix-view/Cargo.toml
@@ -42,7 +42,7 @@ futures-util = { version = "0.3", features = ["std", "async-await"], default-fea
slotmap.workspace = true
-chardetng = "0.1"
+chardetng = "1.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs
index cf7f7bf8..fc1bb4b8 100644
--- a/helix-view/src/document.rs
+++ b/helix-view/src/document.rs
@@ -608,9 +608,13 @@ fn read_and_detect_encoding<R: std::io::Read + ?Sized>(
.map(|encoding| (encoding, false))
.or_else(|| encoding::Encoding::for_bom(buf).map(|(encoding, _bom_size)| (encoding, true)))
.unwrap_or_else(|| {
- let mut encoding_detector = chardetng::EncodingDetector::new();
+ let mut encoding_detector =
+ chardetng::EncodingDetector::new(chardetng::Iso2022JpDetection::Allow);
encoding_detector.feed(buf, is_empty);
- (encoding_detector.guess(None, true), false)
+ (
+ encoding_detector.guess(None, chardetng::Utf8Detection::Allow),
+ false,
+ )
});
let decoder = encoding.new_decoder();