You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The latex_to_unicode function can fail with a rather obsure type error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/dorian/Programs/github/bibtex-autocomplete/venv/lib/python3.11/site-packages/bibtexparser/latexenc.py", line 65, in latex_to_unicode
string = _replace_all_latex(string, itertools.chain(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/dorian/Programs/github/bibtex-autocomplete/venv/lib/python3.11/site-packages/bibtexparser/latexenc.py", line 53, in _replace_all_latex
string = _replace_latex(string, l.rstrip(), u)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/dorian/Programs/github/bibtex-autocomplete/venv/lib/python3.11/site-packages/bibtexparser/latexenc.py", line 35, in _replace_latex
if unicodedata.combining(unicod):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: combining() argument must be a unicode character, not str
The problem is most likely due to line like this one, where the encoding isn't a single unicode character:
Remaining Questions (Optional)
Please tick all that apply:
I would be willing to contribute a PR to fix this issue: my solution would be to put a try except block around the call to unicodedata.combining, assume false if it fails. I haven't submitted this directly because I don't know what these non-unicode characters are and why they are there. If their is a good reason there is probably a better way to handle them, if not they should probably be removed.
This issue is a blocker, I'd be grateful for an early fix.
Describe the bug
The
latex_to_unicode
function can fail with a rather obsure type error:The problem is most likely due to line like this one, where the encoding isn't a single unicode character:
python-bibtexparser/bibtexparser/latexenc.py
Lines 941 to 945 in e4c6eb6
(Although this isn't the only example)
Reproducing
Version: 1.4.1
Code:
Remaining Questions (Optional)
Please tick all that apply:
unicodedata.combining
, assume false if it fails. I haven't submitted this directly because I don't know what these non-unicode characters are and why they are there. If their is a good reason there is probably a better way to handle them, if not they should probably be removed.Related issue: dlesbre/bibtex-autocomplete#12
The text was updated successfully, but these errors were encountered: