0001-Encode-UTF-8-strings-safely.-Refs-2786.patch

nethserver-httpd-admin patch - Davide Principi, 09/29/2014 06:28 AM

Download (1.12 KB)

View differences:

root/usr/libexec/nethserver/smwingsd
26 26
use JSON;
27 27
use esmith::db;
28 28
use base 'Net::Server::Multiplex';
29
use Encode qw(encode decode);
29 30

  
30 31
umask 0117;
31 32
__PACKAGE__->new()->run();
......
91 92
    my $self = shift;
92 93
    my $msg_type = shift;
93 94
    my $response = shift;
94
    my $payload = JSON->new->allow_nonref->latin1->encode($response);
95
    my $payload = encode('UTF-8', JSON->new->allow_nonref->encode($response), Encode::FB_DEFAULT);
95 96
    $self->log(4, ">> $payload");
96 97
    print pack("CN", $msg_type, length($payload)) . $payload;
97 98
}
98
-