Subject: | btparse postprocess() fails to handle Ctrl-M chars in windows-format .bib files |
btparse seems to have been written to assume UNIX line-endings only. So,
on windows, despite removing newlines when processing strings in
entries, it leaves in the Ctrl-M (\r) characters which is a real problem
for further processing tools like Text::BibTeX. All Ctrl-M chars should
be stripped as part of the bt_postprocess_string() routine in
postprocess.c since newlines have already been removed.
The attached patch does this and has been tested with Text::BibTeX 0.38.
Subject: | postprocess.patch |
--- /Users/philkime/Desktop/btparse-0.35 clean/src/postprocess.c 2005-04-04 20:54:54.000000000 +0200
+++ /Users/philkime/Desktop/btparse-0.35/src/postprocess.c 2009-04-30 23:43:57.000000000 +0200
@@ -86,6 +86,9 @@
while (*j != (char) 0)
{
+
+ if (*j == '\r') j++; /* don't want Ctrl-Ms in strings in the output */
+
/*
* If we're in a string of spaces (ie. current and previous char.
* are both space), and we're supposed to be collapsing whitespace,