git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] t/perf: correctly align non-ASCII descriptions in output

From
Jeff King <peff@peff.net>
Date
Apr 21, 2017, 20:41 UTC
Message-ID
<20170421204154.c5mvmnccxkxdm5aw@sigill.intra.peff.net>
In-Reply-To
<20170421194428.1377-1-avarab@gmail.com>
On Fri, Apr 21, 2017 at 07:44:28PM +0000, Ævar Arnfjörð Bjarmason wrote:
Show 6 quoted lines
> Change the test descriptions from being treated as binary blobs by
> perl to being treated as UTF-8. This ensures that e.g. a test
> description like "æ" is counted as 1 character, not 2.
> 
> I have WIP performance tests for non-ASCII grep patterns on another
> topic that are affected by this.

Makes sense. As this is purely about test titles in our project, choosing utf8 as the only encoding is quite sensible.

Show 9 quoted lines
> diff --git a/t/perf/aggregate.perl b/t/perf/aggregate.perl
> index 924b19dab4..1dbc85b214 100755
> --- a/t/perf/aggregate.perl
> +++ b/t/perf/aggregate.perl
> @@ -88,6 +88,7 @@ for my $t (@tests) {
>  sub read_descr {
>  	my $name = shift;
>  	open my $fh, "<", $name or return "<error reading description>";
> +	binmode $fh, ":utf8" or die "PANIC on binmode: $!";

I thought there was some "use" flag we could set to just make all of our handles utf8. But all I could come up with was stuff like PERLIO and "perl -C". Using binmode isn't too bad, though (I think you could just do it as part of the open, too, but I'm not sure if antique versions of perl support that).

-Peff
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 2 of 6 in “t/perf: correctly align non-ASCII descriptions in output”
  1. t/perf: correctly align non-ASCII descriptions in outputÆvar Arnfjörð Bjarmason, Apr 21, 2017
  2. Jeff KingApr 21, 2017
  3. Ævar Arnfjörð BjarmasonApr 21, 2017
  4. Jeff KingApr 21, 2017
  5. Ævar Arnfjörð BjarmasonApr 21, 2017
  6. Jeff KingApr 21, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.