develooper Front page | perl.perl5.porters | Postings from May 2013

[perl #26988] EOF character (0x1A) returned as data when reading text files

Thread Next
From:
James E Keenan via RT
Date:
May 27, 2013 12:55
Subject:
[perl #26988] EOF character (0x1A) returned as data when reading text files
Message ID:
rt-3.6.HEAD-2650-1369659335-741.26988-15-0@perl.org
On Mon Feb 23 10:22:38 2004, weezel wrote:
> This is a bug report for perl from Jeremy@jeremyd-home,
> generated with the help of perlbug 1.34 running under perl v5.8.3.
> 
> 
> -----------------------------------------------------------------
> [Please enter your report here]
> 
> After upgrading from 5.6.1 to 5.8.3 I noticed that perl now returns
the EOF 
> character (0x1A) as if it were normal data. The 0x1A character in a text 
> file on Windows marks the end of valid data. Neither it nor what follows 
> should be returned as data.
> 
> It looks like someone already started thinking about this although I 
> couldn't find an existing bug. perldoc perlio in the :crlf section says:
>     It currently does *not* mimic MS-DOS as far as treating of Control-Z
>     as being an end-of-file marker.
> 
> This program demonstrates the bug.
> 
> open F, "> bug.txt";
> binmode(F);
> print F "Hello World\x0d\x0a\x1a";
> close F;
> 
> open F, "bug.txt";
> while (<F>) {
>     print;
> }
> close F;
> 
> 
> I had to munge the output a bit since I wasn't sure the 0x1A
> (displayed on my screen as a right pointing arrow) would make it
> safely through perlbug.
> 
> C:\perlbug>c:\perl-5.6.1-AS635\bin\perl.exe bug.pl
> Hello World
> 
> C:\perlbug>c:\perl-5.8.3-AS809\bin\perl.exe bug.pl
> Hello World
> (arrow character)
> C:\perlbug>c:\perl\bin\perl.exe bug.pl
> Hello World
> (arrow character)
> 
> 

Is there someone with up-to-date Perl and Windows who could assess the
issues discussed in this older ticket?

Thank you very much.
Jim Keenan

---
via perlbug:  queue: perl5 status: new
https://rt.perl.org:443/rt3/Ticket/Display.html?id=26988

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About