develooper Front page | perl.i18n | Postings from February 2006

Re: Using :encoding and :crlf together?

Thread Previous | Thread Next
Ciaran Hamilton
February 6, 2006 05:29
Re: Using :encoding and :crlf together?
Message ID:

> "Malformed UTF-8 character (unexpected continuation byte 0xa3, with no 
> preceding start byte) in null operation at ./ 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";

print "test-2\n";
open(FILE, ">:crlf:encoding(UTF-16)", "test-2");
print FILE "Test \x{A3}45!\n";
print FILE "Test!\n";

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.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About