Questions tagged [line-endings]

Line-ending signifies end of line. Depending on operating system line-endings are different.

516 questions
0
votes
2 answers

What is changing my line breaks?

I am trying to read some binary data from a command line tool with PHP on Windows. Initially the tool was git show, but I can reproduce the problem with type as well (to make sure there is no Git autocrlf happening). I am not sure what is going on,…
AndreKR
  • 32,613
  • 18
  • 106
  • 168
0
votes
1 answer

Convert line endings when copying from excel to word

Is there an elegant / correct way to deal with CRLF line endings when copying from Excel to Word? We have some text stored in a database that uses \r\n (i.e. CRLF) for new lines. We use a tool[1] to query the database and pull the values into…
Hybrid
  • 576
  • 3
  • 6
  • 10
0
votes
0 answers

Linebreak problems with PHP's mail and Postfix

We have some PHP scripts running which send mails using PHP's mail() function. $message = "Some lengthy text"; $header = "MIME-Version: 1.0\r\n"; $header .= "Content-Type: text/plain; charset=iso-8859-1; format=flowed\r\n"; $header .= "From: Name…
sigy
  • 2,408
  • 1
  • 24
  • 55
0
votes
0 answers

Output redirection on Windows overwrites line endings

Sample C++ program: #include #include int main(int argc, char* argv[]) { if (argc > 1) { std::ofstream output(argv[1]); output << "Line 1\nLine 2\n" << std::flush; } else { std::cout << "Line…
chessbot
  • 436
  • 2
  • 11
0
votes
0 answers

How to call Git Bash from Windows and preserve autocrlf

I have automated python scripts for git versioning system. It works on linux, but I have some problems on windows. I will go directly to the core of the problem... There are sources ended by LF (not CRLF) and Windows Git Bash can handle it perfectly…
Tomas Kubes
  • 23,880
  • 18
  • 111
  • 148
0
votes
1 answer

fprintf ignore ^M carriage returns

I have my fopen set up like this. I have tried my fopen with both "t" and without "t". For some reason my fprintf is printing out ^M which are carriage returns. How do I stop frpintf from doing this? I want to just use the normal new line…
cokedude
  • 379
  • 1
  • 11
  • 21
0
votes
3 answers

Add Carriage-Return utility in C printing garbage?

I have the following program in C, which is intended to convert UNIX text files to Windows format (LF->CR LF). Basically the intended usage is addcr infile > outfile in the command line: #include #include #include…
Govind Parmar
  • 20,656
  • 7
  • 53
  • 85
0
votes
1 answer

git line ends redux - Mac OS git with contributions for Windows user

I do development on Mac OS X. I have a user who is contributing code with CRLF line endings. He currently does not use git. I create a branch, then switch my working tree to it. I copy his file into the working tree. When I try to stage the file, I…
0
votes
0 answers

PHP SoapClient error with line endings

I have a SoapServer running on a windows machine. When I try to instantiate a SoapClient object from a linux machine, it fails with a nice PHP Fatal error: SOAP-ERROR: Parsing WSDL: Couldn't load from…
Gnujeremie
  • 570
  • 3
  • 17
0
votes
1 answer

Same behavior of read line with java randomAccessFile on x32 or x64?

I use java 6 method readByte() from class randomAccessFile to read text files on linux x64. I'm looking the end of text line by finding "0xD" or "0xA" at the end. My question is : in case operating system will switch to x32 , will the find…
Toren
  • 6,648
  • 12
  • 41
  • 62
0
votes
1 answer

git: how to tell if a file accidentally was committed with CRLF

In my specific case, I am using git-p4 and I want to know if git-p4 committed the files with CRLF in the actual committed objects themselves. In general, though, I wan to know how to directly find out. In other words, when I checkout normally,…
Alexander Bird
  • 38,679
  • 42
  • 124
  • 159
0
votes
2 answers

How to remove extra empty lines from file with mac line endings in VS 2008?

So that's the question...perhaps there's a regular expression for this? Just to be clear, I don't want to remove ALL newlines and bunch all of the code together, only the extras. I'm not familiar with how to construct regexes, so any help is greatly…
0
votes
1 answer

Writing/reading a file in binary mode in Clisp

I'm writing this program that's supposed to read from a file, do some stuff with the content and write to an output file preserving the original line endings. If the file has CRLF endings, the output file should also have that. My problem is in…
Plakhoy
  • 1,846
  • 1
  • 18
  • 30
0
votes
1 answer

.gitattributes and normalizing line-endings: changed files still there

I am confused with .gitattributes behavior. Following the article about normalizing line-endings, I have done following steps: created .gitattiributes with * text=auto on my dev Windows machine I have core.autocrlf = true on my build Linux machine…
glaz666
  • 8,707
  • 19
  • 56
  • 75
0
votes
2 answers

How to recover a git repository that has been corrupted by having line endings changes from CRLF to LF?

I changed all of the line endings in my project from dos mode to unix mode by removing all of the carriage returns from any file that had them: grep -lIUr '^M' . | xargs sed -i 's/^M//' I thought that it would ignore hidden dotfiles like .git/, but…
Dan Ross
  • 3,596
  • 4
  • 31
  • 60