fix UTF-8 presentation
This commit is contained in:
parent
de116796d4
commit
7c0af57ccd
@ -8,6 +8,7 @@ use HTTP::Status;
|
|||||||
use JSON;
|
use JSON;
|
||||||
use HTML::Entities;
|
use HTML::Entities;
|
||||||
use PVE::JSONSchema;
|
use PVE::JSONSchema;
|
||||||
|
use Encode qw/decode/;
|
||||||
|
|
||||||
# register result formatters
|
# register result formatters
|
||||||
|
|
||||||
@ -56,7 +57,7 @@ PVE::APIServer::Formatter::register_formatter('json', sub {
|
|||||||
prepare_response_data('json', $res);
|
prepare_response_data('json', $res);
|
||||||
|
|
||||||
my $raw = to_json($res->{data}, {utf8 => 1, allow_nonref => 1});
|
my $raw = to_json($res->{data}, {utf8 => 1, allow_nonref => 1});
|
||||||
|
$raw = decode('UTF-8', $raw, Encode::FB_DEFAULT);
|
||||||
return ($raw, $ct, $nocomp);
|
return ($raw, $ct, $nocomp);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -71,7 +72,7 @@ PVE::APIServer::Formatter::register_formatter('extjs', sub {
|
|||||||
prepare_response_data('extjs', $res);
|
prepare_response_data('extjs', $res);
|
||||||
|
|
||||||
my $raw = to_json($res->{data}, {utf8 => 1, allow_nonref => 1});
|
my $raw = to_json($res->{data}, {utf8 => 1, allow_nonref => 1});
|
||||||
|
$raw = decode('UTF-8', $raw, Encode::FB_DEFAULT);
|
||||||
return ($raw, $ct, $nocomp);
|
return ($raw, $ct, $nocomp);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -87,7 +88,7 @@ PVE::APIServer::Formatter::register_formatter('htmljs', sub {
|
|||||||
prepare_response_data('htmljs', $res);
|
prepare_response_data('htmljs', $res);
|
||||||
|
|
||||||
my $raw = encode_entities(to_json($res->{data}, {allow_nonref => 1}));
|
my $raw = encode_entities(to_json($res->{data}, {allow_nonref => 1}));
|
||||||
|
$raw = decode('UTF-8', $raw, Encode::FB_DEFAULT);
|
||||||
return ($raw, $ct, $nocomp);
|
return ($raw, $ct, $nocomp);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user