Skip to content
This repository has been archived by the owner on Dec 11, 2024. It is now read-only.

sprintf does not convert UTF8 to \x{..} format when emitting in B::C #67

Open
toddr opened this issue Jul 20, 2017 · 0 comments
Open

sprintf does not convert UTF8 to \x{..} format when emitting in B::C #67

toddr opened this issue Jul 20, 2017 · 0 comments

Comments

@toddr
Copy link
Member

toddr commented Jul 20, 2017

WARNING: this program MUST be in a file in UTF-8 mode, NOT Latin1

use utf8;
use warnings;

my $msg = "";
$SIG{__WARN__} = sub { $msg = shift };

sub SKRÈÈÈ;

my $victim = sprintf("%d", *SKRÈÈÈ);
$msg =~ m/Argument "\*main::SKR\\x\{c8}\\x\{c8}\\x\{c8}" isn.t numeric in sprintf/ and print "ok\n";
binmode STDOUT, ":utf8";
print "got=$msg\n"

when run with pure perl, you get:

ok
got=Argument "*main::SKR\x{c8}\x{c8}\x{c8}" isn't numeric in sprintf at foo.pl line 9.

when run with B::C, you get:

got=Argument "*main::SKRÈÈÈ" isn't numeric in sprintf at foo.pl line 9.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

1 participant