I'm tweaking the import/export code in Zotero for BibTeX/BibLaTeX format, particularly, the file attachment field file. AFAICT, the file field has no proper definition in BibTeX, but BibLaTeX documentation says the following about it:
file: field (verbatim)
A local link to a PDF or other version of the work. Not used by the standard biblio- graphy styles.
and
Verbatim fields are processed in verbatim mode and may contain special characters. Typical examples of verbatim fields are file and doi.
Furthermore, from looking around what's been used in the reference manager field (e.g. JabRef), the file field is used in the following form:
file = {Title:/absolute/or/relative/path/to/file:type}
On Windows, this would look like
file = {Title:C:\absolute\or\relative\path\to\file:type}
However, titles and paths may contain special characters which would be incompatible with the "verbatim" mode of this field, i.e. {} (possibly unbalanced), and characters that, if unescaped, would prevent proper parsing of the field, i.e. : in the Windows example.
So my question is what is the most appropriate way to deal with escaping in these fields?
What I have seen in JabRef, is that the characters are escaped with a backslash, so in the Windows example you get
file = {Title:C\:\\absolute\\or\\relative\\path\\to\\file:type}
That looks reasonable to me, but obviously is not verbatim (I think the BibLaTeX definition, or lack thereof, for verbatim fields is not realistic though). Is anyone aware of issues that this could cause?
Sort of as a side question, if the above escaping is OK, is it also OK to denote backslashes in non-verbatim fields with \\? Or does this mean "forced newline" in BibTeX the same way it does in LaTeX? (IIRC, BibTeX syntax doesn't completely follow LaTeX conventions)
For posterity, I will note that some other characters that are must be escaped in the file field using backslash to avoid compatibility issues are ; and $ (the latter seems to mostly affect Mendeley, since Mendeley escapes the first backslash in a Windows file path with $\backslash$ and converts the rest to forward slashes).