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

Re: [PATCH/RFC] Gitweb: Convert UTF-8 encoded file names

From
Junio C Hamano <gitster@pobox.com>
Date
May 14, 2014, 21:57 UTC
Message-ID
<xmqqd2fghvlf.fsf@gitster.dls.corp.google.com>
In-Reply-To
<20140514184145.GA25699@localhost.localdomain>
Michael Wagner <accounts@mwagner.org> writes:
Show 7 quoted lines
> Perl has an internal encoding used to store text strings. Currently, trying to
> view files with UTF-8 encoded names results in an error (either "404 - Cannot
> find file" [blob_plain] or "XML Parsing Error" [blob]). Converting these UTF-8
> encoded file names into Perl's internal format resolves these errors.
>
> Signed-off-by: Michael Wagner <accounts@mwagner.org>
> ---
Cc'ing Jakub, who have been the area maintainer, for comments.

One thing I wonder is that, if there are some additional calls to encode() necessary before we embed $file_name (which are now decoded to the internal string form, not a byte-sequence that happens to be in utf-8) in the generated pages, if we were to do this change.

Show 16 quoted lines
>  gitweb/gitweb.perl | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index a9f57d6..6046977 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -1056,7 +1056,7 @@ sub evaluate_and_validate_params {
>  		}
>  	}
>  
> -	our $file_name = $input_params{'file_name'};
> +	our $file_name = decode("utf-8", $input_params{'file_name'});
>  	if (defined $file_name) {
>  		if (!is_valid_pathname($file_name)) {
>  			die_error(400, "Invalid file parameter");
Previous: Michael WagnerNext: Jakub Narębski
Message 2 of 21 in “Gitweb: Convert UTF-8 encoded file names”
  1. Gitweb: Convert UTF-8 encoded file namesMichael Wagner, May 14, 2014
  2. Junio C HamanoMay 14, 2014
  3. Jakub NarębskiMay 14, 2014
  4. Michael WagnerMay 15, 2014
  5. Peter KreftingMay 15, 2014
  6. Jakub NarębskiMay 15, 2014
  7. Junio C HamanoMay 15, 2014
  8. Michael WagnerMay 15, 2014
  9. Jakub NarębskiMay 15, 2014
  10. Jakub NarębskiMay 15, 2014
  11. Junio C HamanoMay 15, 2014
  12. Jakub NarębskiMay 15, 2014
  13. Junio C HamanoMay 16, 2014
  14. Jakub NarębskiMay 16, 2014
  15. Junio C HamanoMay 16, 2014
  16. Junio C HamanoMay 16, 2014
  17. Jakub NarębskiMay 27, 2014
  18. gitweb: Harden UTF-8 handling in generated linksJakub Narębski, May 27, 2014
  19. Michael WagnerJun 4, 2014
  20. Jakub NarębskiJun 4, 2014
  21. Michael WagnerJun 4, 2014

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.