CC: | dagolden [...] cpan.org, alex [...] chmrr.net |
Encode::Unicode which provides UTF-16 and UTF-32 does not respect Encode::FB_WARN and Encode::WARN_ON_ERR check flags described at: https://metacpan.org/pod/Encode#Handling-Malformed-Data
Test case for invalid UTF-32-LE string "\x78\x56\x34\x12":
$ perl -MEncode -e 'decode("UTF-32-LE", "\x78\x56\x34\x12", Encode::WARN_ON_ERR | Encode::LEAVE_SRC)'
No output, no warning was shown. Same for Encode::FB_WARN.
But if lexical warnings are enabled (-w) then warning "Code point 0x12345678 is not Unicode, may not be portable" is thrown despite if FB_WARN/WARN_ON_ERR is set or not. So module totally ignores Encode::WARN_ON_ERR flag.
Related commits:
https://github.com/dankogai/p5-encode/commit/a6c2ba385875c2c03bd42350e23aef0188fb23b0
https://github.com/dankogai/p5-encode/commit/07c8adb58e55c7cf66b3d6673bf50010fe1a69ea