diff --git a/lib/OpenQA/Schema/Result/Jobs.pm b/lib/OpenQA/Schema/Result/Jobs.pm index 7db6c63c548..5af589bef8a 100644 --- a/lib/OpenQA/Schema/Result/Jobs.pm +++ b/lib/OpenQA/Schema/Result/Jobs.pm @@ -1029,7 +1029,7 @@ sub append_log ($self, $log, $file_name) { my $path = $self->worker->get_property('WORKER_TMPDIR'); return unless -d $path; # we can't help $path .= "/$file_name"; - if (open(my $fd, '>>', $path)) { + if (open(my $fd, '>>:utf8', $path)) { print $fd $log->{data}; close($fd); } diff --git a/lib/OpenQA/WebAPI/Controller/Running.pm b/lib/OpenQA/WebAPI/Controller/Running.pm index 65e057b3dce..f71c9c8b358 100644 --- a/lib/OpenQA/WebAPI/Controller/Running.pm +++ b/lib/OpenQA/WebAPI/Controller/Running.pm @@ -93,7 +93,7 @@ sub streamtext ($self, $file_name, $start_hook = undef, $close_hook = undef) { # if the open fails, continue, well check later my $log; my ($ino, $size); - if (open($log, '<', $logfile)) { + if (open($log, '<:utf8', $logfile)) { # Send the last 10KB of data from the logfile, so that # the client sees some data immediately $ino = (stat $logfile)[1]; @@ -122,7 +122,7 @@ sub streamtext ($self, $file_name, $start_hook = undef, $close_hook = undef) { TEXT_STREAMING_INTERVAL() => sub { if (!$ino) { # log file was not yet opened - return unless open($log, '<', $logfile); + return unless open($log, '<:utf8', $logfile); $ino = (stat $logfile)[1]; $size = -s $logfile; } diff --git a/lib/OpenQA/Worker/Job.pm b/lib/OpenQA/Worker/Job.pm index c49cb364f2b..49b40518a08 100644 --- a/lib/OpenQA/Worker/Job.pm +++ b/lib/OpenQA/Worker/Job.pm @@ -25,6 +25,7 @@ use Try::Tiny; use Scalar::Util 'looks_like_number'; use File::Map 'map_file'; use List::Util 'max'; +use Encode 'decode'; # define attributes for public properties has 'worker'; @@ -1238,7 +1239,7 @@ sub _log_snippet { sysseek($fd, $offset, Fcntl::SEEK_SET); # FIXME: handle error? if (defined sysread($fd, my $buf = '', 100000)) { $ret{offset} = $offset; - $ret{data} = $buf; + $ret{data} = decode('utf-8', $buf); } if (my $new_offset = sysseek($fd, 0, Fcntl::SEEK_CUR)) { $self->{"_$offset_name"} = $new_offset; diff --git a/templates/webapi/step/viewimg.html.ep b/templates/webapi/step/viewimg.html.ep index 41db70e4f2c..a10b7a6e0cd 100644 --- a/templates/webapi/step/viewimg.html.ep +++ b/templates/webapi/step/viewimg.html.ep @@ -1,4 +1,4 @@ -% use Mojo::JSON 'encode_json'; +% use Mojo::JSON 'to_json';
Candidate needles and tags: @@ -37,8 +37,8 @@ % for my $needle (@{$needles_by_tag->{$tag}}) { {selected}) { % $has_selection = 1;