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

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

From
Jakub Narębski <jnareb@gmail.com>
Date
May 15, 2014, 12:32 UTC
Message-ID
<CANQwDwes_G-aNMo=UfGJk+Dk2YaokQsG_VLaVQyPevEDchWTVA@mail.gmail.com>
In-Reply-To
<20140515050820.GA30785@localhost.localdomain>
On Thu, May 15, 2014 at 7:08 AM, Michael Wagner <accounts@mwagner.org> wrote:
Show 21 quoted lines
> On Thu, May 15, 2014 at 12:25:45AM +0200, Jakub Narębski wrote:
>> On Wed, May 14, 2014 at 11:57 PM, Junio C Hamano <gitster@pobox.com> wrote:
>>> Michael Wagner <accounts@mwagner.org> writes:
>>>
>>>> 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.
>>
>> Could you give us an example?  What is important is whether filename
>> is passed via path_info or via query string.
>>
>
> There is a file named "Gütekriterien.txt" in my repository. Trying to
> view this file as "blob_plain" produces an 404 error (displaying the
> file name with an additional print statement):
>
> $ REQUEST_METHOD=GET QUERY_STRING='p=notes.git;a=blob_plain;f=work/G%C3%83%C2%BCtekriterien.txt;hb=HEAD' ./gitweb.cgi
>
> work/Gütekriterien.txt
> Status: 404 Not Found

You have URI encoding of "ü" wrong! "ü" encodes as %C3%BC, not as %C3%83%C2%BC (4 bytes?)

  http://www.url-encode-decode.com/
You tested with wrong input.

BTW. there probably should be test for UTF-8 encoding, similar to the one for XSS in t9502-gitweb-standalone-parse-output

-- 
Jakub Narębski
Previous: Michael Wagner
Message 21 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. Junio C HamanoMay 15, 2014
  7. Michael WagnerMay 15, 2014
  8. Jakub NarębskiMay 15, 2014
  9. Jakub NarębskiMay 15, 2014
  10. Junio C HamanoMay 15, 2014
  11. Jakub NarębskiMay 15, 2014
  12. Junio C HamanoMay 16, 2014
  13. Jakub NarębskiMay 16, 2014
  14. Junio C HamanoMay 16, 2014
  15. Jakub NarębskiMay 27, 2014
  16. Junio C HamanoMay 16, 2014
  17. gitweb: Harden UTF-8 handling in generated linksJakub Narębski, May 27, 2014
  18. Michael WagnerJun 4, 2014
  19. Jakub NarębskiJun 4, 2014
  20. Michael WagnerJun 4, 2014
  21. Jakub NarębskiMay 15, 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.