Skip to content

Inconsistent line endings in /wiki/data/default/data/: \r\n vs. \n #864

@RogerHaase

Description

@RogerHaase

Per https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4: "As with all MIME transmissions, "CR LF" (i.e., `%0D%0A') is used to separate lines of data." e.g. lines of data pulled from a form's textarea are separated by \r\n.

If a text item is edited and saved, the saved file in /wiki/data/default/data/ contains \r\n as line separators.

I believe the above is the desired state.

However, the current "moin get-item ..." incorrectly replaces \r\n with \n in the .data output. As get-item is used to extract the items in /contrib/sample/, these files have incorrect \n line endings. These incorrect line endings then persist when the sample data is loaded on a wiki.

After the py3 conversion, one adverse result is that the code near line 40 in /scripts/main/modify_item.py:

data = rev.data.read().replace('\r\n', '\n')

fails. A solution is to remove the .replace('\r\n', '\n'). The moin item-put command accepts the \r\n line endings as input and retains \r\n when storing the item.

As for the meta data, on windows the meta data is stored with \r\n line endings. *nix systems likely will save data with \n line endings (not yet tested). Both are acceptable as moin item-put stores meta data in Jason format; all line endings are removed.

TODO:

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