[Mimedefang] utf-8 issue?

Bill Cole mdlist-20140424 at billmail.scconsult.com
Thu Dec 14 17:26:38 EST 2017


On 14 Dec 2017, at 9:14 (-0500), Dianne Skoll wrote:

> On Wed, 13 Dec 2017 20:37:36 -0500
> "Bill Cole" <mdlist-20140424 at billmail.scconsult.com> wrote:
>
>> -    return IO::File->new(\ $self->{MBS_Data}, $mode);
>> +    return IO::Scalar->new(\ $self->{MBS_Data}, $mode);
>
> This will cause other problems down the line.  I suggest you
> study the section "Byte and Character Semantics" in the perlunicode
> man page.

Thanks for the reference and for your patience with my confusion. I 
understand much better now: anything expressed as a string has to make 
sense as a series of encoded characters, not a series of bytes.

And as `strings PerlIO/scalar/scalar.bundle` says: "Strings with code 
points over 0xFF may not be mapped into in-memory file handles"

> Modern Perl does let you open a "file" by passing a reference
> to a scalar; it has built-in in-memory I/O.

Indeed. I was fooled by the fact that deep inside the 'open' call stack, 
both $! and $^E get set to "No such file or directory" but that's 
because XSLoader looks for a .bs while loading PerlIO::scalar...

I couldn't find exactly where the "Invalid Argument" error (and matching 
numeric errno) is being generated, since it's in a debug-resistant 
return that pops 4 stack layers in one step, but I'm perfectly happy to 
believe that it's buried in PerlIO/scalar/scalar.bundle and is entirely 
proper.

-- 
Bill Cole
bill at scconsult.com or billcole at apache.org
(AKA @grumpybozo and many *@billmail.scconsult.com addresses)
Currently Seeking Steady Work: https://linkedin.com/in/billcole



More information about the MIMEDefang mailing list