Report mails arriving with content-type: application/octet-stream
Jason L Tibbitts III <[email protected]> Thu, 01 Mar 2018 17:52:18 -0600
| Newsgroups | gmane.comp.archivers.amanda.devel |
|---|---|
| Message-ID | <[email protected]> |
A Fedora user is reporting (in a ticket that's a couple of years old now) that when the system locale is set to de_DE.UTF-8, the report emails may, for the month of March, arrive with the content-type set to application/octet-stream. https://bugzilla.redhat.com/show_bug.cgi?id=1317122 It seems that the Amanda:Report::human::print_header() function will call POSIX::strftime() and depending on various things I don't understand, will produce non-UTF8 output on Fedora (I tested back to Fedora 23). But it's OK on RHEL7. I grabbed the strftime example from perldoc POSIX and ran it: LANG=de_DE.utf8 perl -MPOSIX -e 'print POSIX::strftime( "%A, %B %d, %Y", 0, 0, 0, 19, 2, 95, 2 ), "\n";' On F27: Sonntag, M�rz 19, 1995 On EL7: Dienstag, März 19, 1995 Hopefully that won't get mangled in transit. Basically, the F27 result is not actually utf8. I don't even want to get into why the days of the week are different. Now, if I use binmode to set stdout to utf8: LANG=de_DE.utf8 perl -MPOSIX -e 'binmode(STDOUT, ":utf8"); print POSIX::strftime( "%A, %B %d, %Y", 0, 0, 0, 19, 2, 95, 2 ), "\n";' On F27: Sonntag, März 19, 1995 On EL7: Dienstag, März 19, 1995 Again, if that gets mangled, the EL7 version is now broken. I haven't paid any attention to what's happened in the Perl world in the last decade so I have no idea if there's a good explanation for this or if there is a way to write code that's compatible across versions. So in Fedora we'll probably solve this by patching amreport to call binmode as above, assuming that the reporter confirms that it works. But one other solution is to just force the locale to 'C', either at the top of the script or around the strftime call in Amanda:Report::human::print_header(). Since the report itself isn't going to be translated to the local language, it seems odd that the date would be translated. - J<