fix UTF-8 presentation

This commit is contained in:
Дмитрий Кустов 2024-12-09 18:57:08 +03:00
parent de116796d4
commit 7c0af57ccd

View File

@ -8,6 +8,7 @@ use HTTP::Status;
use JSON;
use HTML::Entities;
use PVE::JSONSchema;
use Encode qw/decode/;
# register result formatters
@ -56,7 +57,7 @@ PVE::APIServer::Formatter::register_formatter('json', sub {
prepare_response_data('json', $res);
my $raw = to_json($res->{data}, {utf8 => 1, allow_nonref => 1});
$raw = decode('UTF-8', $raw, Encode::FB_DEFAULT);
return ($raw, $ct, $nocomp);
});
@ -71,7 +72,7 @@ PVE::APIServer::Formatter::register_formatter('extjs', sub {
prepare_response_data('extjs', $res);
my $raw = to_json($res->{data}, {utf8 => 1, allow_nonref => 1});
$raw = decode('UTF-8', $raw, Encode::FB_DEFAULT);
return ($raw, $ct, $nocomp);
});
@ -87,7 +88,7 @@ PVE::APIServer::Formatter::register_formatter('htmljs', sub {
prepare_response_data('htmljs', $res);
my $raw = encode_entities(to_json($res->{data}, {allow_nonref => 1}));
$raw = decode('UTF-8', $raw, Encode::FB_DEFAULT);
return ($raw, $ct, $nocomp);
});