jgm / pandoc-citeproc

Library and executable for using citeproc with pandoc
BSD 3-Clause "New" or "Revised" License
289 stars 61 forks source link

Error reading bibliography on Windows #368

Closed agitter closed 5 years ago

agitter commented 5 years ago

I am using pandoc with the Manubot project and encountered a pandoc-citeproc issue that appears to be Windows-specific. I am executing a simplified version of the pandoc call in the Manubot build script. My simplified version is:

pandoc --bibliography=output/references.json --output=output/manuscript.html output/manuscript.md

This generates the error:

Error reading bibliography .\output/references.json Error in $: Failed reading: Cannot decode input: Data.Text.Internal.Encoding.decodeUtf8: Invalid UTF-8 stream
Error running filter pandoc-citeproc:
Filter returned error status 1

I am running this in Git bash on Windows 10. It appears that the prefix .\ is prepended to my bibliography filename, and the resulting file .\output/references.json does not exist.

Version info:

$ pandoc --version
pandoc.exe 2.3.1
Compiled with pandoc-types 1.17.5.1, texmath 0.11.1.1, skylighting 0.7.3
$ pandoc-citeproc --version
pandoc-citeproc 0.14.5
jgm commented 5 years ago

The error message suggests that your references.json file is not properly UTF-8 encoded.

You can probably fix it in a decent text editor, or you can use iconv as suggested in the pandoc manual.

agitter commented 5 years ago

Thank you for the suggestion. I had misinterpreted the error message.

Changing to UTF-8 encoding fixed the problem.