- # croak "probably wrong encoding" if is_utf8($record->{text});
- my ($text) = escape_log($record->{text});
+ my $text = $record->{text};
+ if (is_utf8($text)) {
+ carp('Record text was in the wrong encoding (perl internal instead of utf8 octets)');
+ $text = encode_utf8($text)
+ }
+ ($text) = escape_log($text);