https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7305

--- Comment #2 from Mark Martinec <[email protected]> ---
> I suppose the sa-update needs the same setlocale as in spamd:

Decided to address the problem where it happens:

--- lib/Mail/SpamAssassin/Logger/Stderr.pm      (revision 1749344)
+++ lib/Mail/SpamAssassin/Logger/Stderr.pm      (working copy)
@@ -72,8 +72,9 @@
   if (!defined $fmt) {
     # default since 3.3.0
     my $now = Time::HiRes::time;
-    $timestamp = sprintf("%s:%06.3f",
-      POSIX::strftime("%b %d %H:%M", localtime($now)), $now-int($now/60)*60);
+    my $datetime = POSIX::strftime("%b %d %H:%M", localtime($now));
+    utf8::encode($datetime)  if utf8::is_utf8($datetime);  # Bug 7305
+    $timestamp = sprintf("%s:%06.3f", $datetime, $now-int($now/60)*60);
     # Bug 6329: %e is not in a POSIX standard, use %d instead and edit
     local $1; $timestamp =~ s/^(\S+\s+)0/$1 /;
   } elsif ($fmt eq '') {

trunk:
  Sending lib/Mail/SpamAssassin/Logger/Stderr.pm
Committed revision 1749361.

The 3.4 is not affected, as it still does a 'use bytes' in most modules,
sweeping the problem under a carpet.


Now, independently of the above, the question remains:
should a stderr logger issue timestamps in environment's local,
or should a C locale be enforced by a program (like what spamd does,
but not the rest of the utilities).

Example:

LC_ALL=zh_TW.UTF-8 spamassassin -D -t <0.msg
 6月 20 18:48:34.235 [42690] dbg: logger: adding facilities: all
 6月 20 18:48:34.235 [42690] dbg: logger: logging level is DBG
 6月 20 18:48:34.235 [42690] dbg: generic: SpamAssassin version 4.0.0-r1694545

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to