develooper Front page | perl.perl5.porters | Postings from November 2010

Is there a ":cr" I/O layer?

Thread Next
Tom Christiansen
November 19, 2010 09:22
Is there a ":cr" I/O layer?
Message ID:
Perl because treats Darwin as a regular Unix system now, in that \n is LF
and \r is CR, not the other way around.

The problem is all these stupid programs whose "save as text" when running
on a Mac save it in legacy MacRoman encoding and use the old \n=CR system.

	(And don't even get me started about Java's default encoding.)

That means Perl's normally processing on those so-called text doesn't work
transparently.  It's hard to make it do so, since there are now two conflicting
flavors of text file on these systems.  I suppose one can do this:

   use open  IN => ":encoding(MacRoman)",
            OUT => ":utf8";

or load up a PERL5OPTS with an equivalent -M.

But what about the \r problem?  There doesn't appear to be anything 
like a ":cr" PerlIO layer that translates between \r and \n, the way 
there is a :"crlf" layer for the Windows problems.

Should there be?


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