bookdown / Bookdown.Bookdown

Core libraries for Bookdown generation.
http://bookdown.io
MIT License
81 stars 11 forks source link

utf8 encode the search index json #57

Closed pmjones closed 7 years ago

pmjones commented 7 years ago

When generating from a file with unusual characters, generation of the search index JSON failed silently. This PR fixes that in two ways:

  1. Applies utf8_encode() to the search strings in JSON so that json_encode() fails less.
  2. If json_encode() fails when saving the search index, throw an exception with the last JSON error message and code.
pmjones commented 7 years ago

@tobiju @sandrokeil Thoughts?

tobiju commented 7 years ago

Nope, looks good to me.