# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #78148]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=78148 >


First bug report through a tweet, I think:
<http://twitter.com/uasi/status/26009628575>:

@uasi (]):
] @carlmasak open('file', :bin) opens file in utf-8 mode
] regardless of :bin flag. (at line 213 on src/core/IO.pm)

Here's the sub with line 213:

sub open($filename, :$r, :$w, :$a, :$bin) {
    my $mode = $w ?? 'w' !! ($a ?? 'wa' !! 'r');
    my $PIO = pir::open__PSS($filename, $mode);
    unless pir::istrue__IP($PIO) {
        fail("Unable to open file '$filename'");
    }
    $PIO.encoding('utf8'); # <------ this is line 213
    IO.new(:$PIO)
}

The corresponding line in the method IO.open looks like this:

$!PIO.encoding($bin ?? 'binary' !! 'utf8');

Fix might be as simple as copying that line into line 213.

Reply via email to