Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Question marks are not parsed correctly #146

Conversation

tomek12311
Copy link

According to my understanding of the EDIFACT standard, a single ? before a special character (e.g., +, :, ') releases the character, meaning it no longer serves its usual role. Here’s a breakdown:

  • ?' means the apostrophe is released and does not close the segment.
  • ?? means the question mark itself is released as a literal character.
  • ??? results in ? (released) followed by ?' (apostrophe released).
  • ???? results in two released question marks (??) with no special meaning, so an apostrophe following them acts as a segment terminator.

The parser has been updated to correctly interpret these cases, ensuring segment terminators behave as expected based on the parity of preceding question marks.

Changes

  1. Updated terminatorRegex in the parser
  2. Added unit tests to verify the correct parsing of various sequences involving question marks

@sabas sabas merged commit d59afa4 into php-edifact:master Jan 8, 2025
@sabas
Copy link
Collaborator

sabas commented Jan 8, 2025

Merged, too many question marks in my head caused an overflow. rofl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants