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

Re: [JGIT PATCH 2/2] Add getPatchText functions to obtain the plain-text version of a patch

From
Robin Rosenberg <robin.rosenberg.lists@dewire.com>
Date
Dec 13, 2008, 21:26 UTC
Message-ID
<200812132226.47815.robin.rosenberg.lists@dewire.com>
In-Reply-To
<200812131202.07717.robin.rosenberg.lists@dewire.com>
lördag 13 december 2008 12:02:07 skrev Robin Rosenberg:
Show 9 quoted lines
> lördag 13 december 2008 03:42:26 skrev Shawn O. Pearce:
> > The conversion from byte[] to String is performed one line at a time,
> > in case the patch is a character encoding conversion patch for the
> > file.  For simplicity we currently assume UTF-8 still as the default
> > encoding for any content, but eventually we should support using the
> > .gitattributes encoding property when performing this conversion.
> 
> For usefulness we must be able to pass the encoding from outside, 
> e.g. the encoding Eclipse uses, which often is not UTF-8-

It's even worse. You should probably do the encoding guess on the whole patch, or per file and not per line so make success possible at all. Reading and writing as ISO-8859-1 will always work as that is just padding every byte with NUL on reading and dropping it on writing. I.e. if your convert to char at all...

-- robin
Previous: Robin RosenbergNext: Shawn O. Pearce
Message 4 of 5 in “Add raw buffer fetch methods to FileHeader, HunkHeader”
  1. 1/2 Add raw buffer fetch methods to FileHeader, HunkHeaderShawn O. Pearce, Dec 13, 2008
  2. 2/2 Add getPatchText functions to obtain the plain-text version of a patchShawn O. Pearce, Dec 13, 2008
  3. Robin RosenbergDec 13, 2008
  4. Robin RosenbergDec 13, 2008
  5. 2/2 Add getScriptText functions to obtain the plain-text version of a patchShawn O. Pearce, Dec 17, 2008

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.