diff --git a/crates/data/src/dbf.rs b/crates/data/src/dbf.rs index 9388036730..b1bae6922d 100644 --- a/crates/data/src/dbf.rs +++ b/crates/data/src/dbf.rs @@ -194,7 +194,7 @@ pub(crate) fn cause(encoding: &str) -> String { /// What opening a `.dbf` says of its field names that aren't valid in its `encoding` ([`not_utf8`]), /// naming the first five by their column (from 1). `None` when there are none. -pub(crate) fn not_utf8_names_note(columns: &[usize], encoding: &str) -> Option { +pub(crate) fn not_utf8_names_note(columns: &[usize], encoding: &str) -> Option { let (what, label) = match columns.len() { 0 => return None, 1 => (format!("1 field name isn't valid {encoding} and was"), "field"), @@ -202,11 +202,12 @@ pub(crate) fn not_utf8_names_note(columns: &[usize], encoding: &str) -> Option = columns.iter().take(5).map(usize::to_string).collect(); let more = if columns.len() > 5 { format!(" and {} more", columns.len() - 5) } else { String::new() }; - Some(format!( + let text = format!( "Shapefile: {what} read with U+FFFD in place of the bytes that can't be read, in {label} {}{more}; {}", named.join(", "), cause(encoding) - )) + ); + Some(crate::loss::Note::loss(crate::loss::LossCode::ChangedEncoding, text)) } /// What a `.dbf` holds that isn't valid in its `encoding`: which of its field names (by column, from @@ -670,17 +671,21 @@ mod tests { fn field_names_that_arent_utf8_are_said_with_their_columns() { assert_eq!(not_utf8_names_note(&[], "UTF-8"), None); let one = not_utf8_names_note(&[3], "UTF-8").unwrap(); + assert_eq!(one.loss, Some(crate::loss::LossCode::ChangedEncoding)); + let one = one.as_str(); assert!(one.starts_with("Shapefile: 1 field name isn't valid UTF-8 and was read with U+FFFD"), "{one}"); assert!(one.contains("in field 3;"), "{one}"); let two = not_utf8_names_note(&[3, 7], "UTF-8").unwrap(); + let two = two.as_str(); assert!(two.starts_with("Shapefile: 2 field names aren't valid UTF-8 and were read with U+FFFD"), "{two}"); assert!(two.contains("in fields 3, 7;"), "{two}"); assert!(two.ends_with(NO_OTHER_ENCODING), "{two}"); let many = not_utf8_names_note(&[1, 2, 3, 4, 5, 6, 7], "UTF-8").unwrap(); + let many = many.as_str(); assert!(many.contains("in fields 1, 2, 3, 4, 5 and 2 more;"), "{many}"); // A declared code page is named, as what the file declares. assert_eq!( - not_utf8_names_note(&[1], "Big5").as_deref(), + not_utf8_names_note(&[1], "Big5").as_ref().map(crate::loss::Note::as_str), Some( "Shapefile: 1 field name isn't valid Big5 and was read with U+FFFD in place of the bytes that can't be read, in field 1; the .cpg or the .dbf's language driver declares Big5" ) diff --git a/crates/data/src/filegdb.rs b/crates/data/src/filegdb.rs index d6ed830db9..a21ab43367 100644 --- a/crates/data/src/filegdb.rs +++ b/crates/data/src/filegdb.rs @@ -423,9 +423,12 @@ fn read_table(name: &str, t: &[u8], x: &[u8], wkid: Option) -> Result 0 { - report.messages.push(format!( - "{rounded} serial date values were rounded to the nearest microsecond, in {}", - crate::io::named_fields(&ds.fields, &rounded_dates) + report.messages.push(crate::loss::Note::loss( + crate::loss::LossCode::ChangedRounded, + format!( + "{rounded} serial date values were rounded to the nearest microsecond, in {}", + crate::io::named_fields(&ds.fields, &rounded_dates) + ), )); } report.unread_dates = crate::source::unread_dates_note(&ds.fields, &unread_dates); diff --git a/crates/data/src/filegdb/tests.rs b/crates/data/src/filegdb/tests.rs index 170319d5c5..64be0f0044 100644 --- a/crates/data/src/filegdb/tests.rs +++ b/crates/data/src/filegdb/tests.rs @@ -947,6 +947,7 @@ fn filegdb_temporal_fields_keep_days_offsets_and_null_notices() { assert_eq!(notices.len(), usize::from(rounded), "{serial}: {report:?}"); if rounded { assert!(notices[0].contains("1 serial date") && notices[0].contains("moment")); + assert_eq!(notices[0].loss, Some(crate::loss::LossCode::ChangedRounded)); } } } diff --git a/crates/data/src/gml.rs b/crates/data/src/gml.rs index 1cc55b05ab..17642d96a3 100644 --- a/crates/data/src/gml.rs +++ b/crates/data/src/gml.rs @@ -751,7 +751,7 @@ pub fn read(file_name: &str, bytes: &[u8]) -> Result> )); } if let Some(n) = crate::source::null_text_note(&ds.fields, &null_text) { - rep.messages.push(format!("{}: {n}", ds.name)); + rep.messages.push(n.prefixed(&ds.name)); } if parts > 0 { let what = if parts == 1 { "part" } else { "parts" }; @@ -875,7 +875,12 @@ mod tests { assert_eq!(ds.value(0, code), &Value::Text(" R-1".into())); assert_eq!(ds.value(1, code), &Value::Null); assert_eq!(ds.value(2, code), &Value::Text("Laid out".into()), "an indented value loses its layout"); - assert!(report.messages.iter().any(|m| m == "s: 1 value written as Null was read as empty, in 'code'"), "{:?}", report.messages); + assert!( + report.messages.iter().any(|m| m.as_str() == "s: 1 value written as Null was read as empty, in 'code'" + && m.loss == Some(crate::loss::LossCode::AssumedNullMarker)), + "{:?}", + report.messages + ); let clean = gml.replace("<Null>", "B-2"); let layers = read("s.gml", clean.as_bytes()).unwrap(); assert!(layers[0].1.messages.iter().all(|m| !m.contains("written as Null")), "no marker, no notice: {:?}", layers[0].1.messages); diff --git a/crates/data/src/gpx.rs b/crates/data/src/gpx.rs index f0691fcbe2..074285c670 100644 --- a/crates/data/src/gpx.rs +++ b/crates/data/src/gpx.rs @@ -274,7 +274,7 @@ mod tests { assert_eq!(ds.fields[k].ty, FieldType::DateTime); assert!(ds.value(0, k).is_null() && ds.value(2, k).is_null()); assert_eq!(ds.value(1, k).to_string(), "2026-03-05T14:30:00.123456+02:00"); - assert!(report.unread_dates.as_deref().unwrap().starts_with("1 value")); + assert!(report.unread_dates.as_ref().map(crate::loss::Note::as_str).unwrap().starts_with("1 value")); assert!(read("clean.gpx", GPX.as_bytes()).unwrap().iter().all(|(_, r)| r.unread_dates.is_none())); } diff --git a/crates/data/src/io.rs b/crates/data/src/io.rs index f86a6944ea..a48832343e 100644 --- a/crates/data/src/io.rs +++ b/crates/data/src/io.rs @@ -3769,8 +3769,9 @@ struct DbfRead { /// `name` is the layer's, for the error of a `.dbf` it can't open. fn dbf_reader(mut bytes: Vec, cpg: Option<&[u8]>, name: &str) -> Result { use std::io::Cursor; - let mut encoding_notes = Vec::new(); - let encoding = crate::dbf::encoding(cpg, bytes.get(29).copied().unwrap_or(0), &mut encoding_notes); + let mut declared = Vec::new(); + let encoding = crate::dbf::encoding(cpg, bytes.get(29).copied().unwrap_or(0), &mut declared); + let mut encoding_notes = crate::loss::Notes::from(declared); // Counted before a date column is marked a character one below: its values aren't text. let (names, not_utf8) = crate::dbf::not_utf8(&bytes, &encoding); encoding_notes.extend(crate::dbf::not_utf8_names_note(&names, encoding.name())); @@ -3804,7 +3805,7 @@ fn dbf_reader(mut bytes: Vec, cpg: Option<&[u8]>, name: &str) -> Result 0 { let what = if nonfinite_total == 1 { @@ -3962,10 +3963,13 @@ fn dbf_notices(ds: &Dataset, report: &mut ReadReport, counts: &DbfCounts) { } else { format!("{nonfinite_total} numbers aren't finite (nan or inf) and were") }; - report.messages.push(format!("{name}: {what} read as empty, in {}", named_fields(&ds.fields, nonfinite))); + report.messages.push(crate::loss::Note::loss( + crate::loss::LossCode::DroppedValue, + format!("{name}: {what} read as empty, in {}", named_fields(&ds.fields, nonfinite)), + )); } - report.messages.extend(crate::source::null_text_note(&ds.fields, null_text).map(|n| format!("{name}: {n}"))); - report.messages.extend(crate::source::not_utf8_note(&ds.fields, not_utf8, encoding).map(|n| format!("{name}: {n}"))); + report.messages.extend(crate::source::null_text_note(&ds.fields, null_text).map(|n| n.prefixed(name))); + report.messages.extend(crate::source::not_utf8_note(&ds.fields, not_utf8, encoding).map(|n| n.prefixed(name))); } /// The files of a Shapefile, read into memory. @@ -8076,7 +8080,11 @@ mod tests { for (read, (back, report)) in [("whole", whole), ("streamed", streamed)] { assert_eq!(back.features[1].attrs[0], Value::Null, "{read}"); let said = "permits: 1 value written as Null was read as empty, in 'issued'"; - assert!(report.messages.iter().any(|m| m == said), "{read}: {:?}", report.messages); + assert!( + report.messages.iter().any(|m| m.as_str() == said && m.loss == Some(crate::loss::LossCode::AssumedNullMarker)), + "{read}: {:?}", + report.messages + ); assert!(!report.messages.iter().any(|m| m.contains("date")), "{read}: {:?}", report.messages); } } @@ -8109,7 +8117,11 @@ mod tests { assert_eq!(ds.fields[3].ty, FieldType::Double, "{what}: `` doesn't type a column"); assert_eq!(column(3), [Value::Float(1.5), Value::Null, Value::Float(2.5), Value::Float(3.5)], "{what}"); let said = "3 values written as Null were read as empty, in 'code', 'note', 'x'"; - assert!(report.messages.iter().any(|m| m == said), "{what}: {:?}", report.messages); + assert!( + report.messages.iter().any(|m| m.as_str() == said && m.loss == Some(crate::loss::LossCode::AssumedNullMarker)), + "{what}: {:?}", + report.messages + ); } let (_, report) = read_csv("code\n 2535\n", "t").unwrap(); assert!(report.messages.iter().all(|m| !m.contains("written as Null")), "{:?}", report.messages); @@ -9290,7 +9302,8 @@ mod tests { assert_eq!(days, [at("2026-03-05"), Value::Null, Value::Null, at("0001-01-01"), Value::Null], "{read}"); assert!(back.features.iter().all(|f| f.geometry.is_some()), "{read}"); let note = report.messages.iter().find(|m| m.contains("date")).unwrap_or_else(|| panic!("{read}: {report:?}")); - assert_eq!(note, "permits: 1 value isn't a date and was read as empty, in 'issued'", "{read}"); + assert_eq!(note.as_str(), "permits: 1 value isn't a date and was read as empty, in 'issued'", "{read}"); + assert_eq!(note.loss, Some(crate::loss::LossCode::DroppedValue), "{read}"); } } diff --git a/crates/data/src/lib.rs b/crates/data/src/lib.rs index a461f7dea8..72bba19846 100644 --- a/crates/data/src/lib.rs +++ b/crates/data/src/lib.rs @@ -716,10 +716,10 @@ pub struct ReadReport { pub synced: Option, /// What a read of a source says of values in date fields that weren't dates /// ([`source::unread_dates_note`]), also in `messages`: for a caller that says only this. - pub unread_dates: Option, + pub unread_dates: Option, /// What it says of date-times it rounded to the microsecond ([`source::rounded_dates_note`]), /// also in `messages`. - pub rounded_dates: Option, + pub rounded_dates: Option, /// The extrusion the reader suggests for the layer (a city model's volumes): applied when the /// layer is added, and only then; a reload keeps the layer's own. pub extrusion: Option, diff --git a/crates/data/src/loss.rs b/crates/data/src/loss.rs index b7b7585720..787c7d54cc 100644 --- a/crates/data/src/loss.rs +++ b/crates/data/src/loss.rs @@ -85,6 +85,16 @@ loss_codes! { ), ChangedTruncated => ("changed.truncated", Changed, "Use a decimal field to keep the fractional part."), ChangedBody => ("changed.body", Changed, "Export in the layer's own coordinate system, which keeps its body."), + ChangedEncoding => ( + "changed.encoding", + Changed, + "Put a .cpg file naming the file's own encoding beside it." + ), + ChangedRounded => ( + "changed.rounded", + Changed, + "Keep the source file where times finer than a microsecond matter." + ), ChangedPosition => ( "changed.position", Changed, @@ -95,6 +105,11 @@ loss_codes! { Approximated, "Export in the layer's own coordinate system, or give that system with a known transformation to WGS 84." ), + AssumedNullMarker => ( + "assumed.null-marker", + Assumed, + "Write the value another way if the text Null is meant as text, not as an empty value." + ), } impl LossCode { diff --git a/crates/data/src/mapinfo.rs b/crates/data/src/mapinfo.rs index ab8168d06c..ae61655a6f 100644 --- a/crates/data/src/mapinfo.rs +++ b/crates/data/src/mapinfo.rs @@ -582,7 +582,8 @@ mod tests { assert_eq!(ds.value(0, 0), &Value::Text(" 2535 ".into())); assert_eq!(ds.value(0, 1), &Value::Int(7)); assert_eq!(ds.value(1, 0), &Value::Null); - assert_eq!(report.messages, ["1 value written as Null was read as empty, in 'code'"]); + assert_eq!(report.messages.texts().collect::>(), ["1 value written as Null was read as empty, in 'code'"]); + assert_eq!(report.messages[0].loss, Some(crate::loss::LossCode::AssumedNullMarker)); let (_, clean) = read(mif, Some("\" 2535 \", 7 \n\"b\",8\n"), "t").unwrap(); assert!(clean.messages.is_empty(), "no marker, no notice: {:?}", clean.messages); } diff --git a/crates/data/src/sheets.rs b/crates/data/src/sheets.rs index 531bce1624..495010e739 100644 --- a/crates/data/src/sheets.rs +++ b/crates/data/src/sheets.rs @@ -79,9 +79,12 @@ pub fn read(bytes: &[u8], name: &str, sheet: Option<&str>, opts: &CsvOptions) -> report.messages.push(message); } if rounded > 0 { - report.messages.push(format!( - "{rounded} serial date values were rounded to the nearest microsecond, in {}", - crate::io::named_fields(&fields, &g.rounded_dates) + report.messages.push(crate::loss::Note::loss( + crate::loss::LossCode::ChangedRounded, + format!( + "{rounded} serial date values were rounded to the nearest microsecond, in {}", + crate::io::named_fields(&fields, &g.rounded_dates) + ), )); } let others: Vec<&str> = g.names.iter().filter(|n| **n != g.pick).map(String::as_str).take(20).collect(); @@ -741,6 +744,7 @@ mod tests { assert_eq!(notices.len(), usize::from(rounded), "{serial}: {report:?}"); if rounded { assert!(notices[0].contains("1 serial date") && notices[0].contains("moment")); + assert_eq!(notices[0].loss, Some(crate::loss::LossCode::ChangedRounded)); } if serial == "0.500001" { assert_eq!(ds.fields[0].ty, FieldType::Text); @@ -769,14 +773,14 @@ mod tests { let (ds, report) = book(["45000", "60", "45002"]); assert_eq!(ds.fields[0].ty, FieldType::Date); assert!(ds.value(1, 0).is_null()); - assert_eq!(report.unread_dates.as_deref(), Some("1 value isn't a date and was read as empty, in 'a'")); + assert_eq!(report.unread_dates.as_ref().map(crate::loss::Note::as_str), Some("1 value isn't a date and was read as empty, in 'a'")); // A mixed column (text among the dates) says the same, and keeps the rest as text. let (ds, report) = book(["45000", "60", "x"]); assert_eq!(ds.fields[0].ty, FieldType::Text); // (A row left with nothing in it is skipped, as any empty row is.) let seen: Vec = (0..ds.features.len()).map(|r| ds.value(r, 0).to_string()).collect(); assert_eq!(seen, ["2023-03-15", "x"], "{seen:?}"); - assert_eq!(report.unread_dates.as_deref(), Some("1 value isn't a date and was read as empty, in 'a'")); + assert_eq!(report.unread_dates.as_ref().map(crate::loss::Note::as_str), Some("1 value isn't a date and was read as empty, in 'a'")); // Without it, nothing is said. let (_, report) = book(["45000", "61", "x"]); assert_eq!(report.unread_dates, None); diff --git a/crates/data/src/source/mod.rs b/crates/data/src/source/mod.rs index ccf69b6331..b7a2f20d4b 100644 --- a/crates/data/src/source/mod.rs +++ b/crates/data/src/source/mod.rs @@ -327,31 +327,33 @@ pub fn add_unread_dates(counts: &mut Vec, more: &[usize]) { /// What a read says of values in date fields that weren't dates ([`Batch::unread_dates`]), naming /// the first five fields. `None` when there were none. -pub fn unread_dates_note(fields: &[crate::Field], counts: &[usize]) -> Option { +pub fn unread_dates_note(fields: &[crate::Field], counts: &[usize]) -> Option { let total: usize = counts.iter().sum(); if total == 0 { return None; } let what = if total == 1 { "1 value isn't a date and was".to_string() } else { format!("{total} values aren't dates and were") }; - Some(format!("{what} read as empty, in {}", crate::io::named_fields(fields, counts))) + let text = format!("{what} read as empty, in {}", crate::io::named_fields(fields, counts)); + Some(crate::loss::Note::loss(crate::loss::LossCode::DroppedValue, text)) } /// What a read says of text values `` it read as null ([`crate::Value::is_null_marker`], /// [`Batch::null_text`]), naming the first five fields. `None` when there were none. It names the /// marker as `Null`, without its brackets: notices are redacted, which takes `` for a tag. -pub fn null_text_note(fields: &[crate::Field], counts: &[usize]) -> Option { +pub fn null_text_note(fields: &[crate::Field], counts: &[usize]) -> Option { let total: usize = counts.iter().sum(); if total == 0 { return None; } let what = if total == 1 { "1 value written as Null was".to_string() } else { format!("{total} values written as Null were") }; - Some(format!("{what} read as empty, in {}", crate::io::named_fields(fields, counts))) + let text = format!("{what} read as empty, in {}", crate::io::named_fields(fields, counts)); + Some(crate::loss::Note::loss(crate::loss::LossCode::AssumedNullMarker, text)) } /// What a read says of a `.dbf`'s text values that aren't valid in the `encoding` they were read in /// ([`Batch::not_utf8`], [`FeatureSource::text_encoding`]): how many, in which fields (the first five /// named), and why they were read in it. `None` when there were none. -pub fn not_utf8_note(fields: &[crate::Field], counts: &[usize], encoding: &str) -> Option { +pub fn not_utf8_note(fields: &[crate::Field], counts: &[usize], encoding: &str) -> Option { let total: usize = counts.iter().sum(); if total == 0 { return None; @@ -361,22 +363,25 @@ pub fn not_utf8_note(fields: &[crate::Field], counts: &[usize], encoding: &str) } else { format!("{total} text values aren't valid {encoding} and were") }; - Some(format!( + let text = format!( "{what} read with U+FFFD in place of the bytes that can't be read, in {}; {}", crate::io::named_fields(fields, counts), crate::dbf::cause(encoding) - )) + ); + Some(crate::loss::Note::loss(crate::loss::LossCode::ChangedEncoding, text)) } /// What a read says of date-times it rounded to the microsecond ([`Batch::rounded_dates`]), naming /// the first five fields. `None` when there were none. -pub fn rounded_dates_note(fields: &[crate::Field], counts: &[usize]) -> Option { +pub fn rounded_dates_note(fields: &[crate::Field], counts: &[usize]) -> Option { let total: usize = counts.iter().sum(); if total == 0 { return None; } let what = if total == 1 { "1 date-time was".to_string() } else { format!("{total} date-times were") }; - Some(format!("{what} rounded to the microsecond, as more digits than that aren't kept, in {}", crate::io::named_fields(fields, counts))) + let text = + format!("{what} rounded to the microsecond, as more digits than that aren't kept, in {}", crate::io::named_fields(fields, counts)); + Some(crate::loss::Note::loss(crate::loss::LossCode::ChangedRounded, text)) } /// A vector data source read in place. @@ -780,9 +785,9 @@ fn materialize_within(src: &dyn FeatureSource, budget: u64) -> Result<(Dataset, }; let null_text = null_text_note(&info.fields, &null_text); let not_utf8 = not_utf8_note(&info.fields, ¬_utf8, src.text_encoding()); - report.messages.extend(unread_dates.into_iter().chain(rounded).chain(null_text).map(|n| format!("{}: {n}", info.name))); + report.messages.extend(unread_dates.into_iter().chain(rounded).chain(null_text).map(|n| n.prefixed(&info.name))); report.messages.extend(notes.prefixed(&info.name)); - report.messages.extend(not_utf8.into_iter().map(|n| format!("{}: {n}", info.name))); + report.messages.extend(not_utf8.into_iter().map(|n| n.prefixed(&info.name))); if ds.geometry_type == GeometryType::None && let Some(g) = ds.features.iter().find_map(|f| f.geometry.as_ref()) { diff --git a/crates/data/src/source/shp.rs b/crates/data/src/source/shp.rs index af40ca4c61..53248d9d58 100644 --- a/crates/data/src/source/shp.rs +++ b/crates/data/src/source/shp.rs @@ -236,6 +236,7 @@ impl ShpSource { notes.push("coordinates are not longitude/latitude; RustGIS reads them as WGS 84 and they may draw out of place".into()); } let (names, not_utf8) = read_names(&dbf, table.columns.len(), &encoding)?; + let mut notes = crate::loss::Notes::from(notes); notes.extend(crate::dbf::not_utf8_names_note(¬_utf8, encoding.name())); let fields = table.columns.iter().zip(names).map(|(c, n)| Field::new(n, c.out)).collect(); let mut info = SourceInfo { @@ -249,7 +250,7 @@ impl ShpSource { // (`SourceInfo::coordinate_system`) as a whole read does. crs: reproject.crs.definition_text(), indexed: index.indexed(), - notes: notes.into(), + notes, zm_dropped: false, }; // PointZ … MultiPointM: the header's type says every shape carries Z or M values. diff --git a/crates/data/src/source/tests.rs b/crates/data/src/source/tests.rs index 953dc09a34..665e7d1807 100644 --- a/crates/data/src/source/tests.rs +++ b/crates/data/src/source/tests.rs @@ -2480,8 +2480,16 @@ fn shapefile_text_keeps_its_leading_spaces_and_counts_null_markers() { assert_eq!(values, [Value::Text(" 2535".into()), Value::Null, Value::Text("plain".into()), Value::Null]); assert_eq!(inplace.features, whole.features); let said = "codes: 2 values written as Null were read as empty, in 'code'"; - assert!(whole_report.messages.iter().any(|m| m == said), "{:?}", whole_report.messages); - assert!(report.messages.iter().any(|m| m == said), "{:?}", report.messages); + assert!( + whole_report.messages.iter().any(|m| m.as_str() == said && m.loss == Some(crate::loss::LossCode::AssumedNullMarker)), + "{:?}", + whole_report.messages + ); + assert!( + report.messages.iter().any(|m| m.as_str() == said && m.loss == Some(crate::loss::LossCode::AssumedNullMarker)), + "{:?}", + report.messages + ); // Text without the marker says nothing. let mut clean = Dataset::new("clean", GeometryType::Point, vec![Field::new("code", FieldType::Text)]); @@ -4300,7 +4308,9 @@ fn flatgeobuf_classifies_local_dates_and_preserves_remote_text() { assert_eq!(batch.unread_dates, [1, 1]); assert!(batch.features.iter().any(|f| f.attrs[2].to_string() == "12:30:00.123456789")); let (_, report) = materialize(local.as_ref()).unwrap(); - assert!(report.unread_dates.unwrap().contains("2 values")); + let note = report.unread_dates.unwrap(); + assert!(note.contains("2 values")); + assert_eq!(note.loss, Some(crate::loss::LossCode::DroppedValue)); let mut rows = Vec::new(); let streamed = local .visit_chunks(None, 256, &mut |chunk| { diff --git a/crates/data/tests/integration/shapefile_encoding.rs b/crates/data/tests/integration/shapefile_encoding.rs index 48e0bc03f8..4f4cfd2e16 100644 --- a/crates/data/tests/integration/shapefile_encoding.rs +++ b/crates/data/tests/integration/shapefile_encoding.rs @@ -2,6 +2,15 @@ use rustgis_data::{Dataset, Field, FieldType, Geometry, GeometryType, Value, io}; +/// The notes' texts, each read with U+FFFD in place of bytes said as `changed.encoding` and no +/// other with that code. +fn texts(notes: &rustgis_data::loss::Notes) -> Vec<&str> { + for note in notes.iter() { + assert_eq!(note.contains("U+FFFD"), note.loss == Some(rustgis_data::loss::LossCode::ChangedEncoding), "{note:?}"); + } + notes.texts().collect() +} + /// Opens a Shapefile in place, with its index in this process's own temporary cache rather than /// the user's (#1230). #[cfg(not(target_arch = "wasm32"))] @@ -151,12 +160,12 @@ fn text_that_isnt_utf8_is_counted_by_field_when_no_encoding_is_named() { let said = [not_utf8_note(2, "name")]; let layers = io::read_zip("places.zip", &rustgis_data::zip::write(&files).unwrap()).unwrap(); assert_eq!(names(&layers[0].0), read); - assert_eq!(layers[0].1.messages, said, "zipped"); + assert_eq!(texts(&layers[0].1.messages), said, "zipped"); // The `.dbf` on its own, a table. let dbf = &files.iter().find(|(n, _)| n.ends_with(".dbf")).unwrap().1; let (table, report) = io::read_bytes("places.dbf", dbf).unwrap(); assert_eq!(names(&table), read); - assert_eq!(report.messages, said, "the .dbf alone"); + assert_eq!(texts(&report.messages), said, "the .dbf alone"); #[cfg(not(target_arch = "wasm32"))] { use rustgis_data::source::FeatureSource; @@ -167,13 +176,13 @@ fn text_that_isnt_utf8_is_counted_by_field_when_no_encoding_is_named() { let path = dir.path().join("places.shp"); let (ds, report) = io::read_path(&path).unwrap(); assert_eq!(names(&ds), read); - assert_eq!(report.messages, said, "loose files"); + assert_eq!(texts(&report.messages), said, "loose files"); // Read in place: the field names are fine, so opening says nothing; a whole read counts. let src = open_shp(&path, "places").unwrap(); assert!(src.info().notes.is_empty(), "{:?}", src.info().notes); let (ds, report) = rustgis_data::source::materialize(&src).unwrap(); assert_eq!(names(&ds), read); - assert_eq!(report.messages, said, "read in place"); + assert_eq!(texts(&report.messages), said, "read in place"); } } @@ -512,7 +521,7 @@ fn dos_support_preserves_other_encodings_and_lossy_utf8_fallback() { let layers = io::read_zip("places.zip", &rustgis_data::zip::write(&files).unwrap()).unwrap(); assert_eq!(layers[0].0.value(0, 0), &Value::Text(expected.into())); let said = if replaced { vec![not_utf8_note(1, "name")] } else { Vec::new() }; - assert_eq!(layers[0].1.messages, said, "{expected}"); + assert_eq!(texts(&layers[0].1.messages), said, "{expected}"); } } @@ -531,7 +540,7 @@ fn utf8_metadata_preserves_leading_bom_in_fields_and_values() { let layers = io::read_zip("places.zip", &rustgis_data::zip::write(&files).unwrap()).unwrap(); assert_eq!(layers[0].0.fields[0].name, "\u{feff}name"); assert_eq!(layers[0].0.value(0, 0), &Value::Text("\u{feff}Caf�".into())); - assert_eq!(layers[0].1.messages, said); + assert_eq!(texts(&layers[0].1.messages), said); let dir = tempfile::tempdir().unwrap(); for (name, bytes) in files { std::fs::write(dir.path().join(name), bytes).unwrap(); @@ -540,7 +549,7 @@ fn utf8_metadata_preserves_leading_bom_in_fields_and_values() { let (ds, report) = io::read_path(&path).unwrap(); assert_eq!(ds.fields[0].name, "\u{feff}name"); assert_eq!(ds.value(0, 0), &Value::Text("\u{feff}Caf�".into())); - assert_eq!(report.messages, said); + assert_eq!(texts(&report.messages), said); let src = open_shp(&path, "places").unwrap(); assert_eq!(src.info().fields[0].name, "\u{feff}name"); assert_eq!(src.read(&Request::all()).unwrap().features[0].attrs, [Value::Text("\u{feff}Caf�".into())]); @@ -634,7 +643,7 @@ fn check_ldid_readers(ldid: u8, text: &[u8], expected: &str, cpg: Option<&[u8]>, assert_eq!(layers.len(), 1); check(&layers[0].0, 3); assert_eq!(layers[0].1.skipped, 0); - assert_eq!(layers[0].1.messages, notes, "LDID {ldid:02X} ZIP notes"); + assert_eq!(texts(&layers[0].1.messages), notes, "LDID {ldid:02X} ZIP notes"); #[cfg(not(target_arch = "wasm32"))] { use rustgis_data::source::{FeatureSource, Request}; @@ -646,14 +655,14 @@ fn check_ldid_readers(ldid: u8, text: &[u8], expected: &str, cpg: Option<&[u8]>, let (ds, report) = io::read_path(&path).unwrap(); check(&ds, 3); assert_eq!(report.skipped, 0); - assert_eq!(report.messages, notes, "LDID {ldid:02X} loose-file notes"); + assert_eq!(texts(&report.messages), notes, "LDID {ldid:02X} loose-file notes"); let src = open_shp(&path, "places").unwrap(); assert_eq!(src.info().fields[0].name, expected, "LDID {ldid:02X} streamed field name"); let opening: Vec<&str> = notes.iter().copied().filter(|n| !n.starts_with("places: ")).collect(); - assert_eq!(src.info().notes, opening, "LDID {ldid:02X} streamed notes"); + assert_eq!(texts(&src.info().notes), opening, "LDID {ldid:02X} streamed notes"); let whole: Vec = notes.iter().map(|n| if n.starts_with("places: ") { n.to_string() } else { format!("places: {n}") }).collect(); - assert_eq!(rustgis_data::source::materialize(&src).unwrap().1.messages, whole, "LDID {ldid:02X} whole read in place"); + assert_eq!(texts(&rustgis_data::source::materialize(&src).unwrap().1.messages), whole, "LDID {ldid:02X} whole read in place"); for (request, rows, complete) in [(Request { extent: None, limit: 1, own: None }, 1, false), (Request::all(), 3, true)] { let batch = src.read(&request).unwrap(); assert_eq!(batch.matched, 3); @@ -754,13 +763,13 @@ fn malformed_values_are_counted_per_value_and_clean_text_says_nothing() { let files = two_field_parts(b"\x93\x8c\x8b\x9e", b"Y\x82", 0x13, None); let (ds, report) = io::read_zip("places.zip", &rustgis_data::zip::write(&files).unwrap()).unwrap().remove(0); assert_eq!(names(&ds), [Value::Text("東京".into()), Value::Text("Y\u{FFFD}".into()), Value::Text("Tainan".into())]); - assert_eq!(report.messages, [invalid_note(1, "name", "Shift_JIS")]); + assert_eq!(texts(&report.messages), [invalid_note(1, "name", "Shift_JIS")]); // A value that fills its 32 bytes and ends in a lead byte is one malformed value. let mut full = vec![b'A'; 31]; full.push(0x82); let files = parts(&full, 0x13, None); let (_, report) = io::read_zip("places.zip", &rustgis_data::zip::write(&files).unwrap()).unwrap().remove(0); - assert_eq!(report.messages, [invalid_note(1, "name", "Shift_JIS")]); + assert_eq!(texts(&report.messages), [invalid_note(1, "name", "Shift_JIS")]); // The same through a standalone `.dbf` and a read in place. #[cfg(not(target_arch = "wasm32"))] { @@ -769,8 +778,8 @@ fn malformed_values_are_counted_per_value_and_clean_text_says_nothing() { std::fs::write(dir.path().join(name), bytes).unwrap(); } let (_, report) = io::read_path(&dir.path().join("places.dbf")).unwrap(); - assert_eq!(report.messages, [invalid_note(1, "name", "Shift_JIS")]); + assert_eq!(texts(&report.messages), [invalid_note(1, "name", "Shift_JIS")]); let src = open_shp(&dir.path().join("places.shp"), "places").unwrap(); - assert_eq!(rustgis_data::source::materialize(&src).unwrap().1.messages, [invalid_note(1, "name", "Shift_JIS")]); + assert_eq!(texts(&rustgis_data::source::materialize(&src).unwrap().1.messages), [invalid_note(1, "name", "Shift_JIS")]); } } diff --git a/crates/engine/src/cmd/field.rs b/crates/engine/src/cmd/field.rs index 54831e25c4..5920b2fe00 100644 --- a/crates/engine/src/cmd/field.rs +++ b/crates/engine/src/cmd/field.rs @@ -759,7 +759,7 @@ fn copy_stream( source::null_text_note(&info.fields, &batch.null_text), ]; losses.extend(info.notes.iter().chain(&batch.notes).cloned().map(|note| note.prefixed(&layer.name))); - losses.extend(counted.iter().flatten().map(|note| format!("{}: {note}", layer.name))); + losses.extend(counted.into_iter().flatten().map(|note| note.prefixed(&layer.name))); dataset.crs_incomplete = src.lost_to_crs() || (info.format == "Shapefile" && batch.skipped > 0); dataset.features = rows.into(); if dataset.geometry_type == rustgis_data::GeometryType::None diff --git a/crates/engine/src/cmd/gpkg.rs b/crates/engine/src/cmd/gpkg.rs index 9d110ce744..2a5adaedaa 100644 --- a/crates/engine/src/cmd/gpkg.rs +++ b/crates/engine/src/cmd/gpkg.rs @@ -108,10 +108,10 @@ fn add_layer(s: &mut Session, p: &Value) -> CmdResult { ); } if let Some(note) = rustgis_data::source::unread_dates_note(&info.fields, &editable.unread_dates) { - s.notify(format!("{name}: {note}; saving leaves them as they are unless they're edited"), false); + s.say(note.map_text(|note| format!("{name}: {note}; saving leaves them as they are unless they're edited"))); } if let Some(note) = rustgis_data::source::rounded_dates_note(&info.fields, &editable.rounded_dates) { - s.notify(format!("{name}: {note}"), false); + s.say(note.prefixed(&name)); } if !editable.writable { s.notify(format!("{name}: the file is read-only, so edits can't be saved to it"), false); @@ -329,10 +329,10 @@ fn save_edits(s: &mut Session, p: &Value) -> CmdResult { s.notify(note, false); } if let Some(note) = rustgis_data::source::unread_dates_note(&fields, &unread_dates) { - s.notify(format!("{}: {note}, when read back after the save", super::saved_target(&name, table)), false); + s.say(note.map_text(|note| format!("{}: {note}, when read back after the save", super::saved_target(&name, table)))); } if let Some(note) = rustgis_data::source::rounded_dates_note(&fields, &rounded_dates) { - s.notify(format!("{}: {note}, when read back after the save", super::saved_target(&name, table)), false); + s.say(note.map_text(|note| format!("{}: {note}, when read back after the save", super::saved_target(&name, table)))); } if let Some(note) = rustgis_data::io::utc_dates_note(&fields, &utc_dates, &super::saved_target(&name, table)) { s.notify(note, false); @@ -392,7 +392,7 @@ pub(super) fn read_candidate(name: &str, edit: &rustgis_map::source::GpkgEdit) - notes.push(format!("{} rows with a geometry RustGIS can't read weren't loaded; saving leaves them as they are", editable.skipped)); } if let Some(note) = rustgis_data::source::unread_dates_note(&info.fields, &editable.unread_dates) { - notes.push(format!("{note}; saving leaves them as they are unless they're edited")); + notes.push(note.map_text(|note| format!("{note}; saving leaves them as they are unless they're edited"))); } if let Some(note) = rustgis_data::source::rounded_dates_note(&info.fields, &editable.rounded_dates) { notes.push(note); diff --git a/crates/engine/src/cmd/pg.rs b/crates/engine/src/cmd/pg.rs index 7a44f46ee7..98230f836b 100644 --- a/crates/engine/src/cmd/pg.rs +++ b/crates/engine/src/cmd/pg.rs @@ -229,7 +229,7 @@ fn discard_edits(s: &mut Session, p: &Value) -> CmdResult { } s.notify(format!("{name}: edits discarded; {n} rows loaded again from {}", edit.origin.table), false); if let Some(note) = unread { - s.notify(format!("{name}: {note}"), false); + s.say(note.prefixed(&name)); } Ok(json!({"features": n, "matched": editable.matched})) } @@ -412,7 +412,7 @@ fn add_layer(s: &mut Session, p: &Value) -> CmdResult { ); } if let Some(note) = rustgis_data::source::unread_dates_note(&info.fields, &editable.unread_dates) { - s.notify(format!("{layer_name}: {note}"), false); + s.say(note.prefixed(&layer_name)); } if !editable.writable { s.notify(format!("{layer_name}: this user can't insert, update or delete its rows, so edits can't be saved to it"), false); diff --git a/crates/engine/src/cmd/share.rs b/crates/engine/src/cmd/share.rs index e6c3f9be17..6fc42dd184 100644 --- a/crates/engine/src/cmd/share.rs +++ b/crates/engine/src/cmd/share.rs @@ -641,9 +641,9 @@ pub(crate) fn layer_work(s: &Session, p: &Value) -> Result { /// empty because they weren't dates, and date-times rounded to the microsecond /// ([`rustgis_map::Unreadable`]). Every export of a layer read in place says them, the browser's /// download too. -pub fn read_date_notes(file: &str, layer: &str, lost: &rustgis_map::Unreadable) -> Vec { - let empty = lost.dates.iter().map(|n| format!("{file}: {layer}: {n} (empty in the export)")); - empty.chain(lost.rounded.iter().map(|n| format!("{file}: {layer}: {n} when read for the export"))).collect() +pub fn read_date_notes(file: &str, layer: &str, lost: &rustgis_map::Unreadable) -> Vec { + let empty = lost.dates.iter().map(|n| n.clone().map_text(|n| format!("{file}: {layer}: {n} (empty in the export)"))); + empty.chain(lost.rounded.iter().map(|n| n.clone().map_text(|n| format!("{file}: {layer}: {n} when read for the export")))).collect() } /// The complete diagnostics from a whole read made for an export, including metadata losses @@ -732,20 +732,20 @@ fn write_layer(l: &rustgis_map::Layer, path: &str, asked: Option, project: let unfit = rustgis_data::source::parquet::unfit_note(&layer.fields, &e.unfit, path); let moved = rustgis_data::web_mercator_moved_note(path, &layer.name, e.beyond_web_mercator); let mut dates: rustgis_data::loss::Notes = rustgis_data::source::unread_dates_note(&layer.fields, &e.unread_dates) - .map(|n| format!("{path}: {}: {n} (empty in the export)", layer.name)) + .map(|n| n.map_text(|n| format!("{path}: {}: {n} (empty in the export)", layer.name))) .into_iter() .collect(); dates.extend( rustgis_data::source::rounded_dates_note(&layer.fields, &e.rounded_dates) - .map(|n| format!("{path}: {}: {n} when read for the export", layer.name)), + .map(|n| n.map_text(|n| format!("{path}: {}: {n} when read for the export", layer.name))), ); dates.extend( rustgis_data::source::null_text_note(&layer.fields, &e.null_text) - .map(|n| format!("{path}: {}: {n} (empty in the export)", layer.name)), + .map(|n| n.map_text(|n| format!("{path}: {}: {n} (empty in the export)", layer.name))), ); dates.extend( rustgis_data::source::not_utf8_note(&layer.fields, &e.not_utf8, e.not_utf8_in) - .map(|n| format!("{path}: {}: {n}", layer.name)), + .map(|n| n.prefixed(&format!("{path}: {}", layer.name))), ); dates.extend(rustgis_data::io::utc_dates_note(&layer.fields, &e.utc_dates, path)); dates.extend(rustgis_data::io::fine_dates_note(&layer.fields, &e.fine_dates, path)); diff --git a/crates/engine/src/cmd/whole.rs b/crates/engine/src/cmd/whole.rs index 94f74606eb..7aebf28322 100644 --- a/crates/engine/src/cmd/whole.rs +++ b/crates/engine/src/cmd/whole.rs @@ -29,8 +29,8 @@ enum Rows { pub(crate) struct Unread { layer: String, rows: usize, - dates: Option, - rounded: Option, + dates: Option, + rounded: Option, messages: rustgis_data::loss::Notes, } @@ -83,11 +83,8 @@ impl Unread { if self.rows > 0 { s.warn(unread_notice(&self.layer, self.rows)); } - if let Some(dates) = &self.dates { - s.notify(format!("{}: {dates}", self.layer), false); - } - if let Some(rounded) = &self.rounded { - s.notify(format!("{}: {rounded}", self.layer), false); + for note in [&self.dates, &self.rounded].into_iter().flatten() { + s.say(note.clone().prefixed(&self.layer)); } for message in &self.messages { s.say(message.clone()); @@ -96,8 +93,8 @@ impl Unread { /// What [`Unread::say`] says, as lines: for a tool's messages. pub(crate) fn lines(&self) -> rustgis_data::loss::Notes { - let rows = (self.rows > 0).then(|| unread_notice(&self.layer, self.rows)); - let dates = [&self.dates, &self.rounded].into_iter().flatten().map(|n| format!("{}: {n}", self.layer)); + let rows = (self.rows > 0).then(|| rustgis_data::loss::Note::plain(unread_notice(&self.layer, self.rows))); + let dates = [&self.dates, &self.rounded].into_iter().flatten().map(|n| n.clone().prefixed(&self.layer)); let mut lines: rustgis_data::loss::Notes = rows.into_iter().chain(dates).collect(); lines.extend(self.messages.iter().cloned()); lines diff --git a/crates/engine/src/cmd/workflows.rs b/crates/engine/src/cmd/workflows.rs index 6bdd7d8ce9..bd2b08e8b3 100644 --- a/crates/engine/src/cmd/workflows.rs +++ b/crates/engine/src/cmd/workflows.rs @@ -2238,22 +2238,22 @@ pub(crate) fn convert_work(s: &Session, p: &Value) -> Result self.notify_loss(code, note), + None => self.notify_text(note, false), + } } if let Some(message) = notice_text::NoticeText::source_errors(source_error_count, source_errors, source_error_count) { self.notify_text(message, true); diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index c773e714ce..2b3444d84a 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -2212,14 +2212,20 @@ fn loading_a_streamed_layer_whole_says_the_date_times_it_rounded() { /// to dates: values read as empty and date-times rounded; a clean read says nothing. #[test] fn an_export_says_what_its_whole_read_did_to_dates() { + use rustgis_data::loss::{LossCode, Note}; let lost = rustgis_map::Unreadable { rows: 0, - dates: Some("1 value isn't a date and was read as empty, in 'day'".into()), - rounded: Some("1 date-time was rounded to the microsecond, as more digits than that aren't kept, in 'at'".into()), + dates: Some(Note::loss(LossCode::DroppedValue, "1 value isn't a date and was read as empty, in 'day'")), + rounded: Some(Note::loss( + LossCode::ChangedRounded, + "1 date-time was rounded to the microsecond, as more digits than that aren't kept, in 'at'", + )), ..Default::default() }; + let notes = crate::cmd::share::read_date_notes("out.geojson", "Sites", &lost); + assert_eq!(notes.iter().map(|n| n.loss).collect::>(), [Some(LossCode::DroppedValue), Some(LossCode::ChangedRounded)]); assert_eq!( - crate::cmd::share::read_date_notes("out.geojson", "Sites", &lost), + notes.iter().map(Note::as_str).collect::>(), [ "out.geojson: Sites: 1 value isn't a date and was read as empty, in 'day' (empty in the export)", "out.geojson: Sites: 1 date-time was rounded to the microsecond, as more digits than that aren't kept, in 'at' when read for the export", @@ -45272,7 +45278,7 @@ fn postgis_dates_live() { let src = postgis::PostgisSource::open(conn, t, None, None).unwrap(); let b = src.read(&Request { extent: None, limit: 100, own: None }).unwrap(); let note = rustgis_data::source::unread_dates_note(&src.info().fields, &b.unread_dates); - assert_eq!(note.as_deref(), Some("2 values aren't dates and were read as empty, in 'd', 'ts'")); + assert_eq!(note.as_ref().map(rustgis_data::loss::Note::as_str), Some("2 values aren't dates and were read as empty, in 'd', 'ts'")); let f = b.features.iter().find(|f| f.id == 1).unwrap(); assert_eq!(f.attrs.get(3).map(ToString::to_string).as_deref(), Some("2026-03-05T12:30:00Z")); } diff --git a/crates/engine/tests/integration/never_silent_reading.rs b/crates/engine/tests/integration/never_silent_reading.rs index 37788b2c5d..45ffd222da 100644 --- a/crates/engine/tests/integration/never_silent_reading.rs +++ b/crates/engine/tests/integration/never_silent_reading.rs @@ -966,7 +966,9 @@ fn read(dir: &std::path::Path, file: &str, content: &[u8], beside: &[(&str, Vec< check_dbf_date(&native, dbf_invalid)?; } let expected = if csv_extra { &extra_messages } else { &dbf_messages }; - if report.skipped != 0 || &report.messages != expected { + // The invalid date is said as `dropped.value`; the extra cell isn't coded yet. + let coded = report.messages.iter().all(|m| (m.loss == Some(LossCode::DroppedValue)) == dbf_invalid); + if report.skipped != 0 || report.messages.texts().collect::>() != *expected || !coded { return Err(std::io::Error::other(format!("tabular native report: {report:?}"))); } } diff --git a/crates/map/src/lib.rs b/crates/map/src/lib.rs index b2e37b4cf7..8d179cfd13 100644 --- a/crates/map/src/lib.rs +++ b/crates/map/src/lib.rs @@ -154,10 +154,10 @@ pub struct Unreadable { pub rows: usize, /// What it says of values in date fields that weren't dates, read as null /// ([`rustgis_data::source::unread_dates_note`]). - pub dates: Option, + pub dates: Option, /// What it says of date-times rounded to the microsecond /// ([`rustgis_data::source::rounded_dates_note`]). - pub rounded: Option, + pub rounded: Option, /// Other reader diagnostics, already qualified by their source. Date diagnostics stay in /// their typed fields above so consumers can describe what an export did to them once. pub messages: rustgis_data::loss::Notes, @@ -873,7 +873,7 @@ impl Layer { let (ds, report) = self.load_all_with_notices()?; // materialize also puts the typed date diagnostics in messages. Existing consumers // give them their own export wording, so preserve only the other messages here. - let date_notes: Vec<_> = report.unread_dates.iter().chain(&report.rounded_dates).map(|n| format!(": {n}")).collect(); + let date_notes: Vec<_> = report.unread_dates.iter().chain(&report.rounded_dates).map(|n| format!(": {}", n.as_str())).collect(); let mut seen = std::collections::HashSet::new(); let messages: rustgis_data::loss::Notes = report .messages diff --git a/crates/map/src/source.rs b/crates/map/src/source.rs index 2d36f7fbc2..7be5fe6775 100644 --- a/crates/map/src/source.rs +++ b/crates/map/src/source.rs @@ -890,7 +890,7 @@ impl SourceLayer { /// What view reads found of values in date fields that weren't dates /// ([`rustgis_data::source::unread_dates_note`]) and of date-times rounded to the microsecond /// ([`rustgis_data::source::rounded_dates_note`]), once for the source. - pub fn take_unread_dates(&mut self) -> (Option, Option) { + pub fn take_unread_dates(&mut self) -> (Option, Option) { let Some(fields) = self.info().map(|i| i.fields.clone()) else { return (None, None) }; let (unread, rounded) = (std::mem::take(&mut self.unread_dates).total(), std::mem::take(&mut self.rounded_dates).total()); if unread.is_none() && rounded.is_none() { @@ -914,7 +914,7 @@ impl SourceLayer { /// What view reads found of text values `` read as null /// ([`rustgis_data::source::null_text_note`]), once for the source. - pub fn take_null_text(&mut self) -> Option { + pub fn take_null_text(&mut self) -> Option { let fields = self.info().map(|i| i.fields.clone())?; let counts = std::mem::take(&mut self.null_text).total()?; self.null_text_said = true; @@ -937,7 +937,7 @@ impl SourceLayer { /// What view reads found of text values that aren't UTF-8 /// ([`rustgis_data::source::not_utf8_note`]), once for the source. - pub fn take_not_utf8(&mut self) -> Option { + pub fn take_not_utf8(&mut self) -> Option { // Checked first: this runs every frame for each layer with a source, and most have nothing pending. if self.not_utf8.is_empty() { return None; diff --git a/docs/cli.md b/docs/cli.md index bcb8e0e773..b5ba259f40 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -166,8 +166,11 @@ An `--allow` that names no kind or code is refused with status 2, as is `--allow | `dropped.crs-name` | Keep the source file's coordinate system definition with the export. | | `changed.truncated` | Use a decimal field to keep the fractional part. | | `changed.body` | Export in the layer's own coordinate system, which keeps its body. | +| `changed.encoding` | Put a .cpg file naming the file's own encoding beside it. | +| `changed.rounded` | Keep the source file where times finer than a microsecond matter. | | `changed.position` | Export in a coordinate system that holds the positions, such as WGS 84. | | `approximated.datum` | Export in the layer's own coordinate system, or give that system with a known transformation to WGS 84. | +| `assumed.null-marker` | Write the value another way if the text Null is meant as text, not as an empty value. | Not every loss has a code yet: losses still reported without one don't stop a strict run.