I'm trying to generate documentation pdf file with pandoc's markdown2pdf. My source file contains some cyrillic UTF-8 symbols. My system locale is en_US.UTF-8.

When run in default locale, markdown2pdf fails to load document:

$ markdown2pdf doc.md -o doc.pdf

markdown2pdf: /tmp/pandoc/doc.log: hGetContents: invalid argument (Invalid or incomplete multibyte or wide character)

If I set LANG=ru_RU.UTF-8, markdown2pdf loads document fine, launches pandoc and pandoc breaks (note different error text):

$ LANG=ru_RU.UTF-8 markdown2pdf doc.md -o doc.pdf
markdown2pdf: pandoc: doc.md: hGetContents: invalid argument (Invalid or incomplete multibyte or wide character)

I do not want to change my system locale. How can I fix this issue?

System information:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 10.04.1 LTS
Release:    10.04
Codename:   lucid

$ uname -a
Linux localhost 2.6.32-24-generic #38-Ubuntu SMP Mon Jul 5 09:20:59 UTC 2010 x86_64 GNU/Linux

$ pandoc --version
  • NOTE: This problem does not exist in pandoc 1.6, but I'd like to stick to version from Ubuntu distribution (which is, still, Jul 24 '10 at 19:42

I had to manually upgrade to pandoc 1.6 which fixes this bug:

  # Install and update cabal (Haskell's package manager)
  sudo apt-get install cabal
  cabal update
  cabal install cabal-install
  # Put cabal's executables to path
  echo "PATH=${PATH}:${HOME}/.cabal/bin" >> ${HOME}/.bashrc
  source ${HOME}/.bashrc
  # Reset bash's path cache
  hash -r

  cabal install -fhighlighting pandoc

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.