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

parsing of escaped double quotes in double quote delimited fields fails #487

Open
1 of 2 tasks
detlevd opened this issue Jul 16, 2024 · 0 comments
Open
1 of 2 tasks

Comments

@detlevd
Copy link

detlevd commented Jul 16, 2024

Describe the bug
When processing bibtex entries, where the fields are delimited by double quotes, embedded double quotes should be escaped by {"}, according to https://tug.ctan.org/info/bibtex/tamethebeast/ttb_en.pdf, page 20. v2.0.0b7 however can't cope with that.
Can't see an easy fix in the current parsing technique.

Reproducing

Version: 2.0.0b7

Code:

import bibtexparser
# title according to page 20 of https://tug.ctan.org/info/bibtex/tamethebeast/ttb_en.pdf
bibentrytext = '''
@inproceedings{quotingproblem,
        pages = "23--26",
        title = "Comments on {"}Filenames and Fonts{"}",
}
'''
library = bibtexparser.parse_string(bibentrytext)
new_bibtex_str = bibtexparser.write_string(library)
print(new_bibtex_str)

Bibtex:

@inproceedings{quotingproblem,
        pages = "23--26",
        title = "Comments on {"}Filenames and Fonts{"}",
}

Workaround
Find such fields by hand and use {...} delimiters. Since long or multiline fields (abstract, long titles, ...) might be affected, this is not easily done in a secure way with some REs.

Remaining Questions (Optional)
Please tick all that apply:

  • I would be willing to contribute a PR to fix this issue.
  • This issue is a blocker, I'd be grateful for an early fix.
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

No branches or pull requests

1 participant