Hi,
"Malformed UTF-8 character (unexpected continuation byte 0xa3, with no
preceding start byte) in null operation at ./utf16-test.pl line 6."
Some more info that seems to be relevant: I'm using the Cygwin build of
Perl when I get this error. Win32 ActiveState Perl seems to ignore the
order of the layers. When running this file:
---
#!/usr/bin/perl -w
print "test-1\n";
open(FILE, ">:encoding(UTF-16):crlf", "test-1");
print FILE "Test \x{A3}45!\n";
print FILE "Test!\n";
close(FILE);
print "test-2\n";
open(FILE, ">:crlf:encoding(UTF-16)", "test-2");
print FILE "Test \x{A3}45!\n";
print FILE "Test!\n";
close(FILE);
---
Under Win32 AS, it comes up with no errors or warnings. In both files
the pound sign is output correctly (ie. as a 00 A3 sequence) but the CR
isn't encoded, and the UTF-16 file is corrupt.
Under Cygwin, I get the "Malformed UTF-8 character" message on test-1,
and the pound sign is replaced with a null. The CR, however, is encoded
correctly. test-2 is identical to the Win32 files.
I haven't had the opportunity yet to test this on v5.8.7 of Perl on
Linux yet, but I'll do so at the earliest opportunity.
- Ciaran.