Bug 24606: Fix encoding issues on decoded content
authorTomas Cohen Arazi <tomascohen@theke.io>
Fri, 11 Nov 2022 18:26:39 +0000 (15:26 -0300)
committerTomas Cohen Arazi <tomascohen@theke.io>
Fri, 11 Nov 2022 18:38:18 +0000 (15:38 -0300)
commit8bc4409773b3f955ab3dac80689eeea0bccddc2b
tree3ebcea057481344f22f921b28797fd7c22352192
parent1d65a71cf617459eb24d3d024987a73e58180db7
Bug 24606: Fix encoding issues on decoded content

This patch makes the `decoded_contents` method UTF-8 encode the data
before calling the relevant decode_json, as expected by the JSON library
[1].

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Item/Template.t
=> FAIL: Tests fail!
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!

[1] `Any decoding or encoding (e.g. to UTF-8 or UTF-16) needs to be done
yourself, e.g. using the Encode module.` https://metacpan.org/pod/JSON

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Koha/Item/Template.pm