CDSoft / pp

PP - Generic preprocessor (with pandoc in mind) - macros, literate programming, diagrams, scripts...
http://cdelord.fr/pp
GNU General Public License v3.0
252 stars 21 forks source link

Error with Mustache directive on UTF-8 Json file #74

Closed ngirard closed 5 years ago

ngirard commented 5 years ago

Using latest pp.

Create test.json containing

{ "attr": "é" }

and test.md containing

!mustache(test.json)
\```````````````````````````````````````
{{attr}}
\```````````````````````````````````````

pp -html < test.md fails with the following error message:

pp: Mustache (test.json): Error in $: Failed reading: Cannot decode input: Data.Text.Internal.Encoding.decodeUtf8: Invalid UTF-8 stream
ngirard commented 5 years ago

On-topic: https://stackoverflow.com/questions/27669418

Two people advised using encodeUtf8 :: Text -> ByteString from Data.Text.Encoding instead of pack from Data.ByteString.Lazy.Char8

CDSoft commented 5 years ago

Thanks. This fixes the bug. I'll release a new version soon.

ngirard commented 5 years ago

Great, thanks !

CDSoft commented 5 years ago

Fixed in 2.7.3.