Subject: | Dropped output when encoding to non utf8 |
Hello,
I'm the maintainer of the Debian packages for XML::SAX::Writer. A user
of the Debian packages reported the following bug to me:
XML::SAX::Writer has an encoding feature which uses Text::Iconv to
encode characters when writing them out to files. This is enabled by
using the EncodeFrom/EncodeTo arguments to new(). Unfortunately it
doesn't check the return code from the Text::Iconv::convert function,
which can be undef. The result is that if Text::Iconv can't encode a
character, this character (and potentially some characters around it)
are dropped on the floor without an error message. An error can occur
for instance if you have UTF8 input data and specify conversion to
iso-8859-1, because not all UTF8 characters can be encoded in
iso-8859-1.
This is a serious bug because it can cause unnoticed data loss.