grpc-perl
grpc-perl copied to clipboard
Unicode bug?
Hello,
I’m looking over this library and notice a lot of use of plain SvPV. This causes Unicode-handling bugs, such as can be seen if you apply this patch:
diff --git a/t/01-call_credentials.t b/t/01-call_credentials.t
index c22dc5a..725a4f5 100644
--- a/t/01-call_credentials.t
+++ b/t/01-call_credentials.t
@@ -105,7 +105,8 @@ ok($event->{method} eq '/abc/dummy_method',"event->method has wrong value");
# print STDERR "event=".Dumper($event);
# Dump($event);
-my $status_text = 'xyz';
+my $status_text = "\xe9xyz";
+utf8::upgrade($status_text);
my $server_call = $event->{call};
$event = $server_call->startBatch(
Grpc::Constants::GRPC_OP_SEND_INITIAL_METADATA() => {},
Am I right in thinking that all strings into and out of this module are meant to be byte buffers? That being the case, the sensible fix would be to replace SvPV and SvPV_nolen with SvPVbyte and SvPVbyte_nolen, respectively. It would be a breaking change, though, for anything that depends on the current behaviour.