[Mimedefang] Wide character in print at /usr/bin/mimedefang.pl

alan premselaar alien at 12inch.com
Thu Apr 2 21:09:51 EDT 2015



On 03/12/15 02:22, vieri at openmailbox.org wrote:
> On 2015-03-10 20:20, vieri at openmailbox.org wrote:
>> Hi,
>>
>> I noticed that a decade ago some users detected "Wide character in
>> print" messages in their mimedefang logs.
>> It was supposedly fixed by adding
>>
>>
>> export LC_ALL=C
>>
>>
>> in the mimedefang init script.
>>
>> (perl unicode issue)
>>
>> However, my Linux distro (Gentoo) runs the following in the mimedefang
>> init script:
>>
>> LC_ALL=C
>> export LC_ALL
>>
>> but I'm occasionally getting the "Wide character in print" messages.
>>
>> I'm running v 2.75 and Perl 5.18.2.
>>
>> Any ideas?
>
> Hi again,
>
> Just wanted to add that I modified /usr/bin/mimedefang.pl for
> debugging purposes:
>
> /usr/bin/mimedefang.pl:
>
> sub action_notify_sender ($) {
> [...]
>     if (open(FILE, ">>NOTIFICATION")) {
> <------>md_syslog('err', "action_notify_sender print FILE $msg");
> [...]
>
[snip...]

Assuming that the problem occurs when you're printing to FILE, you need
to add the following after you open the file:

binmode(FILE, ':utf8');

I'm fairly certain that LC_ALL won't have any effect on output to a file
other than STDOUT/STDERR and even still, that basically forces the
terminal into 7bit mode so would exacerbate the problem. 
binmode(<filehandle>, ':utf8') forces I/O to/from the filehandle to be
in utf8 as opposed to whatever your default encoding may be.

it's been a while so I'm not positive, but you may also need/benefit
from 'use utf8;' ... you should check the docs for more specific details
on that one.

hope this helps.

alan




More information about the MIMEDefang mailing list