develooper Front page | perl.perl5.porters | Postings from April 2011

Malformed UTF-8 tolerated in single-quoted strings

Thread Next
From:
Tom Christiansen
Date:
April 30, 2011 09:07
Subject:
Malformed UTF-8 tolerated in single-quoted strings
Message ID:
22364.1304179616@chthon
Isn't this a bug?

    % blead -CS -le 'print qq(print "\xB0C";)' 
    print "°C";

    % blead -CS -le 'print qq(print \x27\xB0C\x27;)'
    print '°C';

    % blead -C0 -le 'print qq(print "\xB0C";)' | blead -Mutf8 -CS -l
    Malformed UTF-8 character (unexpected continuation byte 0xb0, with no preceding start byte) at - line 1.
    C

    % blead -C0 -le 'print qq(print \x27\xB0C\x27;)' | blead -Mutf8 -CS -l
    #C

That is, it correctly detects the bad UTF-8 when 
it's in double quotes, but not when it's in single ones.

Isn't this an error?

--tom

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