The universal binary is now built seamlessly with 'Cocoa: Mac binary package for Mac OS X 10.5-10.6' (works in 10.7 as well).
Signed-off-by: Denis Loginov <dinvlad@gmail.com>
Here's what happens. At some moment during dictionary conversion,
in DslScanner::readNextLine(), whe call iconv(), when both buffers
are of size 4 (the conversion is from UTF-8 to UTF-16).
Now, the dictionary contains two em-dash symbols at that position,
one after another, each is encoded in 3 bytes in UTF-8. So, the
input buffer of size 4 contains entire first em-dash (3 bytes)
and the first byte from the second em-dash.
Calling iconv() on Linux leads to Iconv::NeedMoreOut (E2BIG),
which makes sense, since we converted the first char and there is
no more space in the output buffer.
Calling iconv() on Windows leads to Iconv::NeedMoreIn (EINVAL),
which *also* makes sense, since we converted the first char, started
to look at the second one and noticed that it is incomplete.
The difference is only what iconv() checks first, the state
of the input or the state of the output. And it seems that it
does different things on Windows and Linux.
The patch takes this into account and resolves the conversion
problem on Windows: the only error condition that requires
to throw an encoding error is when outBytesLeft is non-empty,
that means that iconv didn't convert anything.