Skip to content

Exports don't say when they drop control characters (KML, GPX), when text is cut at a NUL (Shapefile), or KML fields named like its own columns #2415

Done

Description

@flight1973

Three more silent losses on export, found while working on #1907 (#2414). Each changes text with no notice:

  • Control characters (KML, GPX): the writer drops control characters from names and data values (interop::xml()). So "a\u{1}" is written as a, and the change isn't said. It also hides the Exports don't say when text is trimmed, blank text becomes null, or an empty field is left out #1907 notices: "a \u{1}" is written as a and read back as a, but the export counts the value before the characters are dropped, so the trim isn't counted either.
  • NUL bytes (Shapefile): reading a .dbf cuts text at the first NUL byte, so "ab\0cd" reads back as "ab" and "\0x" as null.
  • KML fields named like the reader's own columns: a field called folder or style whose values all match the reader's column of that name is dropped on read.

Each needs an export notice with a count and the fields, like the #1907 notices.

Activity

  1. flight1973 commented on Nov 18, 2026

    @flight1973
    ContributorAuthor

    More found in review of #2414, all from before it:

    • A leading apostrophe (CSV): text such as '=x isn't guarded on write, since it already starts with ', but reading takes the ' off as a guard. So it comes back as =x.
    • A field with a blank name (KML): it's written as <Data name="">, and reading drops every entry with a blank name. So the column and all its values are gone.
    • Parts of a feature (KML, GPX): reading keeps a feature but drops its parts that don't fit: a line part with fewer than 2 points in range, a polygon after the first with an outer ring under 3, and a multipoint's points outside longitude/latitude. fix(data): exports say text that reading the file back trims or reads as null (#1907) #2414 says when a whole feature won't read back, but not these.
  2. bearinmindcat commented on Nov 22, 2026

    @bearinmindcat
    Contributor

    I'll take the parts of this that are still open on main (9cc7d88). I checked the comments and the open PRs, and found no claim or PR.

    Already handled on main:

    I'll add a counted export notice, naming the fields, as #1907's are, for each of the three that remain:

    • NUL bytes (Shapefile): text with a NUL in what the .dbf keeps. Reading keeps only the text before it, and a value starting with one reads as empty. This goes in TextLosses, under its Dbf read.
    • A leading apostrophe (CSV): text like '=x, whose apostrophe reading takes for the formula guard and drops. This also goes in TextLosses, under its Cell read. No way of writing it reads back exactly with today's reader, so it's said rather than changed.
    • A blank field name (KML): a field whose name is blank once trimmed, written as <Data name="">. Reading drops every such entry, so the column and its values are gone. This goes next to kml_empty_fields_note.

    Tests both ways: each loss written and read back gives its notice with the count and the fields, and clean text gives none. Each test fails on main first.

  3. flight1973 commented on Nov 28, 2026

    @flight1973
    ContributorAuthor

    Everything here is covered on main now. Control characters in KML and GPX are refused with an error since #2174, vertices that don't read back are counted since #2414, and #2749 added the NUL, CSV apostrophe and blank KML field name notices (thanks @bearinmindcat). Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions