Skip to content

Commit

Permalink
Fix newline encoding issue in zip_list print
Browse files Browse the repository at this point in the history
Certain obscure newline characters were being printed literally, leading
to unexpected newlines in the formatted output (affecting zip_lists,
Components, and Datasets).

Fix by specifically re-encoding those characters
  • Loading branch information
pvandyken committed Sep 19, 2023
1 parent e7801c0 commit cfd10a9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion snakebids/io/printing.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@


def quote_wrap(val: str) -> str:
return json.dumps(val, ensure_ascii=False)
return (
json.dumps(val, ensure_ascii=False)
.replace("\x85", "\\x85")
.replace("\u2028", "\\u2028")
.replace("\u2029", "\\u2029")
)


def format_zip_lists(
Expand Down

0 comments on commit cfd10a9

Please sign in to comment.