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

Re: jgit problems for file paths with non-ASCII characters

From
Robin Rosenberg <robin.rosenberg@dewire.com>
Date
Nov 25, 2009, 21:11 UTC
Message-ID
<200911252211.55137.robin.rosenberg@dewire.com>
In-Reply-To
<4B0D356D.1080709@syntevo.com>
onsdag 25 november 2009 14:47:25 skrev  Marc Strapetz:
Show 24 quoted lines
> I have noticed that jgit converts file paths to UTF-8 when querying the
> repository. Especially,
> org.eclipse.jgit.treewalk.filter.PathFilter#PathFilter performs this
> conversion:
>
>   private PathFilter(final String s) {
>     pathStr = s;
>     pathRaw = Constants.encode(pathStr);
>   }
>
> Because of this conversion, a TreeWalk fails to identify a file with
> German umlauts. When using platform encoding to convert the file path to
> bytes:
>
>   private PathFilter(final String s) {
>     pathStr = s;
>     pathRaw = s.getBytes();e pr
>   }
>
> the TreeWalk works as expected. Actually, the file path seems to be
> stored with platform encoding in the repository.
>
> Is this a bug or a misconfiguration of my repository? I'm using jgit
> (commit e16af839e8a0cc01c52d3648d2d28e4cb915f80f) on Windows.
A bug. 

The problem here is that we need to allow multiple encodings since there is no reliable encoding specified anywhere. The approach I advocate is the one we use for handling encoding in general. I.e. if it looks like UTF-8, treat it like that else fallback. This is expensive however and then we have all the other issues with case insensitive name and the funny property that unicode has when it allows characters to be encoding using multiple sequences of code points as empoloyed by Apple.

-- robin
-- robin
Previous: Marc StrapetzNext: Shawn O. Pearce
Message 2 of 10 in “jgit problems for file paths with non-ASCII characters”
  1. Marc StrapetzNov 25, 2009
  2. Robin RosenbergNov 25, 2009
  3. Shawn O. PearceNov 26, 2009
  4. Thomas SingerNov 26, 2009
  5. Johannes SchindelinNov 26, 2009
  6. Thomas SingerNov 26, 2009
  7. Shawn O. PearceNov 26, 2009
  8. Robin RosenbergNov 26, 2009
  9. Marc StrapetzNov 26, 2009
  10. Shawn O. PearceNov 26, 2009

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.