{"thread":{"id":"16034","subject":"git adds some text file as binary file by mistake","startedAt":"2008-10-24T12:37:01Z","lastAt":"2008-10-31T00:29:16Z","messageCount":7,"participants":["Ping Yin","Michael J Gruber","Bruce Stephens","Robin Rosenberg"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"93847","messageId":"46dff0320810240537i4f0d86b9p56def9ef6a69c180@mail.gmail.com","threadId":"16034","inReplyTo":null,"subject":"git adds some text file as binary file by mistake","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-10-24T12:37:01Z","receivedAt":"2008-10-24T12:37:01Z","isPatch":false,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"So what should i do if i want it added as text file?\n\n--\nPing Yin\n"},{"id":"93849","messageId":"4901C58D.4010309@drmicha.warpmail.net","threadId":"16034","inReplyTo":"46dff0320810240537i4f0d86b9p56def9ef6a69c180@mail.gmail.com","subject":"Re: git adds some text file as binary file by mistake","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2008-10-24T12:54:37Z","receivedAt":"2008-10-24T12:54:37Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Ping Yin venit, vidit, dixit 24.10.2008 14:37:\n> So what should i do if i want it added as text file?\n\nYou should give us more detail on the file ;)\nWhat's the extension, what's the typical content? It may be a simple\nmatter of specifying attributes.\nDo ordinary diff and grep recognize your files as text?\n\nMichael\n"},{"id":"93850","messageId":"46dff0320810240630s5cbfa62esd10a9da45ce37bf8@mail.gmail.com","threadId":"16034","inReplyTo":"4901C58D.4010309@drmicha.warpmail.net","subject":"Re: git adds some text file as binary file by mistake","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-10-24T13:30:19Z","receivedAt":"2008-10-24T13:30:19Z","isPatch":false,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"On Fri, Oct 24, 2008 at 8:54 PM, Michael J Gruber\n<git@drmicha.warpmail.net> wrote:\n> Ping Yin venit, vidit, dixit 24.10.2008 14:37:\n>> So what should i do if i want it added as text file?\n>\n> You should give us more detail on the file ;)\n> What's the extension, what's the typical content? It may be a simple\n> matter of specifying attributes.\n> Do ordinary diff and grep recognize your files as text?\n>\n> Michael\n>\n\nIt's just an xml file. I guess maybe there are some hidden characters\nat the beginning. I will figure it out later because i have no access\nto that file right now.\n\nI'm just ask this problem in general sense. So is there a general way\nto specify whether  a file is text or binary?\n\n\n\n-- \nPing Yin\n"},{"id":"93851","messageId":"80tzb2xgk5.fsf@tiny.isode.net","threadId":"16034","inReplyTo":"46dff0320810240630s5cbfa62esd10a9da45ce37bf8@mail.gmail.com","subject":"Re: git adds some text file as binary file by mistake","fromName":"Bruce Stephens","fromEmail":"bruce.stephens@isode.com","sentAt":"2008-10-24T13:34:34Z","receivedAt":"2008-10-24T13:34:34Z","isPatch":false,"sender":{"key":"bruce.stephens@isode.com","avatar":null},"body":"\"Ping Yin\" <pkufranky@gmail.com> writes:\n\n[...]\n\n> I'm just ask this problem in general sense. So is there a general way\n> to specify whether  a file is text or binary?\n\nYes: gitattributes(5).\n"},{"id":"93854","messageId":"4901D2DD.8050704@drmicha.warpmail.net","threadId":"16034","inReplyTo":"46dff0320810240630s5cbfa62esd10a9da45ce37bf8@mail.gmail.com","subject":"Re: git adds some text file as binary file by mistake","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2008-10-24T13:51:25Z","receivedAt":"2008-10-24T13:51:25Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Ping Yin venit, vidit, dixit 24.10.2008 15:30:\n> On Fri, Oct 24, 2008 at 8:54 PM, Michael J Gruber\n> <git@drmicha.warpmail.net> wrote:\n>> Ping Yin venit, vidit, dixit 24.10.2008 14:37:\n>>> So what should i do if i want it added as text file?\n>> You should give us more detail on the file ;)\n>> What's the extension, what's the typical content? It may be a simple\n>> matter of specifying attributes.\n>> Do ordinary diff and grep recognize your files as text?\n>>\n>> Michael\n>>\n> \n> It's just an xml file. I guess maybe there are some hidden characters\n> at the beginning. I will figure it out later because i have no access\n> to that file right now.\n\nMaybe it's in an encoding which is not available on the machine you're\nusing git on?\n\n> I'm just ask this problem in general sense. So is there a general way\n> to specify whether  a file is text or binary?\n\nBruce suggested a good read. To save you some time: You want to say\n\n*.xml diff\n\nor\n\n*.xml diff crlf\n\nin one of the attributes files, depending on whether you want git to\npossibly translate line endings (which depends on other settings also).\nNote that the \"content type\" of the file plays a role only for diffs and\nstats, not for the actual storage (except for, possibly, crlf conversion).\n\nCheers,\nMichael\n"},{"id":"94262","messageId":"46dff0320810292332y34ea0daemde05b58572946497@mail.gmail.com","threadId":"16034","inReplyTo":"46dff0320810240630s5cbfa62esd10a9da45ce37bf8@mail.gmail.com","subject":"Re: git adds some text file as binary file by mistake","fromName":"Ping Yin","fromEmail":"pkufranky@gmail.com","sentAt":"2008-10-30T06:32:47Z","receivedAt":"2008-10-30T06:32:47Z","isPatch":false,"sender":{"key":"pkufranky@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5346?v=4"},"body":"On Fri, Oct 24, 2008 at 9:30 PM, Ping Yin <pkufranky@gmail.com> wrote:\n> On Fri, Oct 24, 2008 at 8:54 PM, Michael J Gruber\n> <git@drmicha.warpmail.net> wrote:\n>> Ping Yin venit, vidit, dixit 24.10.2008 14:37:\n>>> So what should i do if i want it added as text file?\n>>\n>> You should give us more detail on the file ;)\n>> What's the extension, what's the typical content? It may be a simple\n>> matter of specifying attributes.\n>> Do ordinary diff and grep recognize your files as text?\n>>\n>> Michael\n>>\n>\n> It's just an xml file. I guess maybe there are some hidden characters\n> at the beginning. I will figure it out later because i have no access\n> to that file right now.\n>\n> Ping Yin\n>\n\nI have figured it out. It's just because the BOM characters feff00 in\nthe beginning of the utf-8 xml file.\n\n-- \nPing Yin\n"},{"id":"94356","messageId":"200810310129.16847.robin.rosenberg.lists@dewire.com","threadId":"16034","inReplyTo":"46dff0320810292332y34ea0daemde05b58572946497@mail.gmail.com","subject":"Re: git adds some text file as binary file by mistake","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg.lists@dewire.com","sentAt":"2008-10-31T00:29:16Z","receivedAt":"2008-10-31T00:29:16Z","isPatch":false,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"torsdagen den 30 oktober 2008 07.32.47 skrev Ping Yin:\n> On Fri, Oct 24, 2008 at 9:30 PM, Ping Yin <pkufranky@gmail.com> wrote:\n> > On Fri, Oct 24, 2008 at 8:54 PM, Michael J Gruber\n> > <git@drmicha.warpmail.net> wrote:\n> >> Ping Yin venit, vidit, dixit 24.10.2008 14:37:\n> >>> So what should i do if i want it added as text file?\n> >>\n> >> You should give us more detail on the file ;)\n> >> What's the extension, what's the typical content? It may be a simple\n> >> matter of specifying attributes.\n> >> Do ordinary diff and grep recognize your files as text?\n> >>\n> >> Michael\n> >>\n> >\n> > It's just an xml file. I guess maybe there are some hidden characters\n> > at the beginning. I will figure it out later because i have no access\n> > to that file right now.\n> >\n> > Ping Yin\n> >\n> \n> I have figured it out. It's just because the BOM characters feff00 in\n> the beginning of the utf-8 xml file.\n\nThe UTF-8 BOM is EF BB BF, (no NUL.). FEFF is UTF-16 BE (and the third\nbyte would be 00 for an XML file). I think git currently regards just about\nany UTF-16 file as binary becuase of the NUL bytes.\n\n-- robin\n"}]}