From: Eric Wong Date: Mon, 11 Apr 2016 04:44:53 +0000 (+0000) Subject: import: use bytes::length for true data length in bytes X-Git-Tag: v1.0.0~610 X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=commitdiff_plain;h=4284a260374b0c6d90a3f95b387b82a6f64f3125 import: use bytes::length for true data length in bytes git is byte-oriented and fast-import will not tolerate miscalculations. This is necessary for wide characters in commit messages (email Subjects). --- diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm index 4c7bbf14..5bae69df 100644 --- a/lib/PublicInbox/Import.pm +++ b/lib/PublicInbox/Import.pm @@ -168,7 +168,7 @@ sub add { print $w "commit $ref\nmark :$commit\n", "author $name <$email> $date\n", "committer $self->{ident} ", now2822(), "\n", - "data ", (length($subject) + 1), "\n", + "data ", (bytes::length($subject) + 1), "\n", $subject, "\n\n" or wfail; binmode $w, ':raw' or die "binmode :raw failed: $!";