You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make header text round-trip consistently across sources #915
WFDB-Python can write header text that it cannot read back unchanged. The writer uses UTF-8 (io/util.py and archive writes in _header.py), but local header reads use ASCII with errors="ignore" (record.py), which silently drops non-ASCII characters. PhysioNet header reads decode as ISO-8859-1 (download.py), so the same UTF-8 bytes are interpreted differently by source. Cloud and archive paths need to be covered by the same decision.
Comments have a separate loss: _parse_header_fields uses line.strip(" \t#"), removing leading and trailing spaces and # characters. For example, a written comment # #hash reads back as hash.
This predates #914. That PR restricts its new metadata edit methods to text that survives the current reader, but it does not settle the package-wide header policy. Legacy writers can still write text that is silently changed on read.
Decision and tests
Choose and document a consistent encoding for local, cloud, archive, and PhysioNet headers. If existing Latin-1 headers need support, define an explicit fallback rather than silently dropping bytes.
Decide whether comments should preserve edge spaces and #, or whether writers should reject them before writing.
Add read/write round-trip tests for Unicode names, units, and comments, plus existing Latin-1 headers and comment edge cases, across the supported source types.
Activity
Add validated RecordData channel and comment edits (#914)