]> Sergey Matveev's repositories - public-inbox.git/commitdiff
import: use bytes::length for true data length in bytes
authorEric Wong <e@80x24.org>
Mon, 11 Apr 2016 04:44:53 +0000 (04:44 +0000)
committerEric Wong <e@80x24.org>
Mon, 11 Apr 2016 04:57:53 +0000 (04:57 +0000)
git is byte-oriented and fast-import will not tolerate
miscalculations.  This is necessary for wide characters
in commit messages (email Subjects).

lib/PublicInbox/Import.pm

index 4c7bbf14678342e2eeaf70af358afa671b822964..5bae69df4d349f1e40a898df0bf3972684eff588 100644 (file)
@@ -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: $!";