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

Re: git adds some text file as binary file by mistake

From
Robin Rosenberg <robin.rosenberg.lists@dewire.com>
Date
Oct 31, 2008, 00:29 UTC
Message-ID
<200810310129.16847.robin.rosenberg.lists@dewire.com>
In-Reply-To
<46dff0320810292332y34ea0daemde05b58572946497@mail.gmail.com>
torsdagen den 30 oktober 2008 07.32.47 skrev Ping Yin:
Show 23 quoted lines
> On Fri, Oct 24, 2008 at 9:30 PM, Ping Yin <pkufranky@gmail.com> wrote:
> > On Fri, Oct 24, 2008 at 8:54 PM, Michael J Gruber
> > <git@drmicha.warpmail.net> wrote:
> >> Ping Yin venit, vidit, dixit 24.10.2008 14:37:
> >>> So what should i do if i want it added as text file?
> >>
> >> You should give us more detail on the file ;)
> >> What's the extension, what's the typical content? It may be a simple
> >> matter of specifying attributes.
> >> Do ordinary diff and grep recognize your files as text?
> >>
> >> Michael
> >>
> >
> > It's just an xml file. I guess maybe there are some hidden characters
> > at the beginning. I will figure it out later because i have no access
> > to that file right now.
> >
> > Ping Yin
> >
> 
> I have figured it out. It's just because the BOM characters feff00 in
> the beginning of the utf-8 xml file.

The UTF-8 BOM is EF BB BF, (no NUL.). FEFF is UTF-16 BE (and the third byte would be 00 for an XML file). I think git currently regards just about any UTF-16 file as binary becuase of the NUL bytes.

-- robin
Previous: Ping Yin
Message 7 of 7 in “git adds some text file as binary file by mistake”
  1. Ping YinOct 24, 2008
  2. Michael J GruberOct 24, 2008
  3. Ping YinOct 24, 2008
  4. Bruce StephensOct 24, 2008
  5. Michael J GruberOct 24, 2008
  6. Ping YinOct 30, 2008
  7. Robin RosenbergOct 31, 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.