Skip to content

Error is formatted incorrectly when 0-width characters are in use. #572

Closed

Description

@NorfairKing

I know this is nitpicky but I felt it important to point out in case this is supposed to be supported.

Here is an example error:

Failed to parse message:
1:1:
  |
1 | <empty line>
  | ^
<pure>:1:64:
  |
1 | 34=149=XXXX_XXX_XXXX52=20240930-15:03:41.83656=XXXXX.TEST57=XXXXX.XXX298=0108=3010=198
  |                                                                ^
Unknown field tag: 57

As you can see, the ^ is pointing at the wrong character.
I think this is because there are invisible (0-width) \SOH characters inbetween fields.

Activity

  1. self-assigned this
    on Jun 14, 2026
  2. simonmichael commented on Jun 22, 2026

    @simonmichael
    Contributor

    This has caused the ^ position marker to disappear from some error messages. Eg "unexpected newline at end of line" errors - extremely common in hledger's parsers - now render with no pointer at all.

    A natural fix on megaparsec's side would be to floor pointerLen at 1 when elen computes to 0.

  3. mrkkrp commented on Jun 23, 2026

    @mrkkrp
    Owner

    Hey, thanks for letting me know. I will release a version with a fix later today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions