Skip to content

Commit b952969

Browse files
committed
fix: improve CRLF handling in decoder
1 parent 43fd07b commit b952969

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/toon_format/_scanner.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,13 @@ def to_parsed_lines(
207207
if not source.strip():
208208
return [], []
209209

210+
# Normalize Windows CRLF line endings to LF
211+
# This prevents stray \r characters from appearing in content
212+
source = source.replace("\r\n", "\n")
213+
214+
# Strip any remaining standalone \r characters (old Mac format)
215+
source = source.replace("\r", "\n")
216+
210217
lines = source.split("\n")
211218
parsed: List[ParsedLine] = []
212219
blank_lines: List[BlankLineInfo] = []

0 commit comments

Comments
 (0)