-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Feature proposal
Enhance the CSV parser to support fully configurable escaped fields, in alignment with the direction and edge case handling described in PHILOSOPHY.md
.
Requirements:
- Configurable Escape Character:
- Allow users to define a custom escape character for fields (default:
"
). - All parsing and serialization logic must respect this configuration.
- Allow users to define a custom escape character for fields (default:
- Escaped Field Support:
- Escaped fields must be surrounded by the escape character.
- Escaped fields can contain any character, including the delimiter and newline.
- Escape characters inside an escaped field must be represented by doubling them.
- Escaped fields must be strictly validated: leading/trailing whitespace, improper closures, or unescaped escape characters should result in errors as per the philosophy.
- Enable/Disable (De)serialization:
- Provide an option to toggle escape field (de)serialization logic on or off. When disabled, fields should be treated as unescaped (raw) text.
- Edge Case Handling:
- Follow all edge cases as outlined in PHILOSOPHY.md, including:
- Trailing delimiter produces an empty field.
- Empty escaped fields are valid.
- Whitespace around escape characters invalidates the field.
- Backslash escaping is not supported (fail on use).
- Inconsistent row lengths, empty lines, and other failure cases should be handled as described.
- Follow all edge cases as outlined in PHILOSOPHY.md, including:
References
- See
PHILOSOPHY.md
for guiding principles, supported/unsupported cases, and design rationale.
Example scenarios
- Parsing CSV rows with custom escape characters (e.g.,
'
instead of"
). - Ensuring invalid formats (e.g., whitespace around escape characters, missing closure) produce immediate errors.
- Optionally serializing data without any escaping.
This feature is crucial for maintaining compatibility with real-world CSV data while upholding strict data integrity and fail-fast behavior.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request