I think this was (at least partly) a wrong alarm: it seems that it's
the byte sequence 0x00 0x0a that makes <FH> groan about partial
characters. If I do things "right" and convert also the "\n" (aka 0xa)
to (little-endian) UTF-16 (0x0a 0x00), things work without warnings.
(I've not figured out yet what really goes on with the 0x00 0x0a case.)
$ ./perl -e 'print pack("v*", 0xFEFF, unpack("C*", "test"))' >! utf16
$ hex utf16
ff fe 74 00 65 00 73 00 74 00 ..t.e.s.t.
$ ./perl -Ilib -we 'open(FH, "<:encoding(utf16)", "utf16");print <FH>'
$ ./perl -le 'print pack("v*", 0xFEFF, unpack("C*", "test"))' >! utf16
$ hex utf16
ff fe 74 00 65 00 73 00 74 00 0a ..t.e.s.t..
$ ./perl -Ilib -we 'open(FH, "<:encoding(utf16)", "utf16");print <FH>'
UTF-16:Partial character at -e line 1.
UTF-16:Partial character at -e line 1.
UTF-16:Partial character at -e line 1, <FH> line 1.
kosh:~/pp4/maint-5.8/perl ; ./perl -e 'print pack("v*", 0xFEFF, unpack("C*",
"test\n"))' >! utf16
$ hex utf16
ff fe 74 00 65 00 73 00 74 00 0a 00 ..t.e.s.t...
$ ./perl -Ilib -we 'open(FH, "<:encoding(utf16)", "utf16");print <FH>'
test
$
--
Jarkko Hietaniemi <jhi(_at_)iki(_dot_)fi> http://www.iki.fi/jhi/ "There is this
special
biologist word we use for 'stable'. It is 'dead'." -- Jack Cohen