- changed title to Pybtex escapes ampersands incorrectly when writing to file
- edited description
Pybtex escapes ampersands incorrectly when writing to file
There are some things which need to be escaped in bibtex, e.g. {{F}orce capitalization}
, This \& that
and so on. When using BibliographyData#to_file(bib_format='bibtex')
, ampersands get escaped, while other things get rendered correctly. This not only destroys urls, but compounds as a file is read and written mutliple times. There must be a way to avoid this without plugging in a custom Writer
.
The problem seems to be that codecs.encode(text, 'ulatex+{}'.format(self.encoding))
in bibtex.py
assumes the text passed in is not already latex, but rather some plain text format (in self.encoding
encoding). This is usually a misplaced assumption, since the text in BibTex files will often have LaTeX escapes inside, meaning it is already latex
-encoded.
Am I misunderstanding something?
Comments (7)
-
reporter -
reporter - edited description
-
reporter - edited description
-
reporter - edited description
-
reporter - edited description
-
reporter - edited description
-
- changed status to resolved
Looks like it's fixed in sphinxcontrib-bibtex.
- Log in to comment