diff options
author | Dan Fandrich <danf@mageia.org> | 2025-02-17 16:09:21 -0800 |
---|---|---|
committer | Dan Fandrich <danf@mageia.org> | 2025-02-17 16:10:18 -0800 |
commit | ce9772e170adb496b6b3a14da8ee0b537c6010f8 (patch) | |
tree | 85b0c4b895e9d8635e180a782dc183858924b220 | |
parent | de99d3fd825cef502d237106a42eb990ed9a92d6 (diff) | |
download | mgaadvisories-ce9772e170adb496b6b3a14da8ee0b537c6010f8.tar mgaadvisories-ce9772e170adb496b6b3a14da8ee0b537c6010f8.tar.gz mgaadvisories-ce9772e170adb496b6b3a14da8ee0b537c6010f8.tar.bz2 mgaadvisories-ce9772e170adb496b6b3a14da8ee0b537c6010f8.tar.xz mgaadvisories-ce9772e170adb496b6b3a14da8ee0b537c6010f8.zip |
template: fix encoding i18n text in JSON advisories
The default JSON encoding assumed the input was Latin-1, not the UTF-8
it is.
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | tmpl/advisory.json | 4 |
2 files changed, 3 insertions, 2 deletions
@@ -3,6 +3,7 @@ Version 0.X - loading all advisories is much faster on multicore machines - sort fields in templated output for consistency - template: change default CVE year to 2025 +- template: fix encoding i18n text in JSON advisories Version 0.31 diff --git a/tmpl/advisory.json b/tmpl/advisory.json index 6194f38..bd2b306 100644 --- a/tmpl/advisory.json +++ b/tmpl/advisory.json @@ -3,8 +3,8 @@ use JSON; [% END -%] [% MACRO jsonvar(var) PERL -%] -# JSON-encode the given variable, including quotes -print JSON::encode_json($stash->get($stash->get('var'))); +# JSON-encode the given variable, including adding quotes +print JSON->new->utf8(0)->encode($stash->get($stash->get('var'))); [% END %] [%- SET adv = advdb.advisories.$advisory -%] { |