line-endings

preg_replace removes multiple “\n”s

落花浮王杯 提交于 2019-12-24 00:59:32
问题 How do I remove multiple occurrences of \n from the sample below and replace with just one occurrence of \n ? Basically I just want to remove multiple line breaks and replace them with just one line break. \n\n\n\n\n\n\n\n \n\n \n\n\n\n\n\n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n \n \n \n \n \n \n\n \n\n \n\n \nEDITION: U.S.\n\n \nINTERNATIONAL\n\n \nMÉXICO\n\n \n\n \nSet edition preference\n\n \n\n \n\n \n\n \nSign up\n\n \nLog in\n\n \n\n \n\n \n\n \n\n \n\n\n\n\n\n\n\n\n\n\n\n \n\n \n\n\n

Files incorrectly reported modified - git attributes buggy? leading to inconsistent repo

隐身守侯 提交于 2019-12-23 17:12:23
问题 This easily leads to a inconsistent git repository: If a file is committed with crlf line endings with the text attribute unset in the working tree, but the text attribute is set in the repo, the file will be incorrectly shown as modified. I am reproducing this using Git 1.8.5 on a Mac (Darwin 13.1.0) with core.autocrlf set to false. The effect is the same as in this question: Git files modified after checkout, reset --hard, etc. even though autocrlf is set to false All you have to do is to

What is the easiest way to convert all files in git repo to LF line endings

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-23 14:23:53
问题 So I have an old repo, with many files, some are CRLF, some are LF. I want to (1) change ALL files to LF (I have used dos2unix to convert my files, but git commit ignores those changes!) I have also set git config --global core.autocrlf to false. (2) prohibit all future checkins that have CRLF or auto-convert them to LF. How do I do so? Sorry for the rant. I have read multiple posts here and I can't believe this is so counterintuitive. I have seem many configs like core.safecrlf, core

How to convert the line endings of a text file from DOS to Unix?

一世执手 提交于 2019-12-23 05:33:07
问题 I have this php code saved in text file, I want to convert this text file to Unix line endings. How? <?php class City { private $lat=0.0; private $lng=0.0; private $name=""; private $visited=false; private $order=1; function City($name,$lat,$lng) { $this->name=$name; $this->lat=$lat; $this->lng=$lng; } function getName() { return $this->name; } function getLat() { return $this->lat; } function getLng() { return $this->lng; } function getOrder() { return $this->order; } function getVisited() {

Verify line ending in git repo

故事扮演 提交于 2019-12-23 01:17:31
问题 Is there any way to verify the line endings for a file in the git repo? If I checkout then the working directory can be influenced by core.autocrlf or .gitattributes, etc. Is there anything like "svn get" that doesn't checkout but simply copies a file from the repository to my local filesystem somewhere (assuming this ignores any line ending conversion settings)? 回答1: If I checkout then the working directory can be influenced by core.autocrlf or .gitattributes, etc. yes, it can. Is there

git ignore line endings

折月煮酒 提交于 2019-12-22 06:37:36
问题 I know that similar questions have been asked, but I still can't get it working. My project is shared among people using different operating systems, and I'm on OSX. Also, not everyone uses git yet and I end up sometimes having to commit changes of others. Sometimes, out of nowhere git says there are pending changes. Looking at the files they look identical: @@ -1,6 +1,6 @@ -<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment" - xmlns:x="http://schemas.microsoft.com/winfx

Enforce LF line endings with CsvHelper

依然范特西╮ 提交于 2019-12-22 05:16:08
问题 If I have some LF converted (using N++) CSV files, everytime I write data to them using JoshClose's CsvHelper the line endings are back to CRLF. Since I'm having problems with CLRF ROWTERMINATORS in SQL Server, I whish to keep my line endings like the initital status of the file. Couldn't find it in the culture settings, I compile my own version of the library. How to proceed? 回答1: From what I can tell, the line terminator isn't controlled by CvsHelper. I've gotten it to work by adjusting the

^M characters in git commit message (git commit -v)

眉间皱痕 提交于 2019-12-22 04:59:14
问题 I am having a weird problem where lots of ^M characters show up in my git commit message. Please find a screenshot attached. This is not causing any problems, just makes it annoying to read through. Tips appreciated. 回答1: "The Proper Way", if you use Git in cross-platform environment, contrary to Abhijeet's answer, is: Learn and CORRECTLY configure core.autocrlf settings in each client Read local topic "Why should I use core.autocrlf=true in Git?" as good starting point 回答2: Thats a windows

Force svn:eol-style=native on the server?

ε祈祈猫儿з 提交于 2019-12-22 01:51:49
问题 Currently, in order to ensure the subversion property eol-style is set to native for each new file added to our project, we have to add this to the ~/.subversion/config file on each of our developers machines: [miscellany] enable-auto-props = yes [auto-props] *.java = svn:eol-style=native Is there a way to do the equivalent on the svn server? 回答1: No there is not. You can use a hook scripts to look for the property to be set or not, but apart from that it's not possible. Subversion,

fread(): reading table with \r\r\n as newline symbol

倾然丶 夕夏残阳落幕 提交于 2019-12-21 17:47:25
问题 I have tab-delimited tables in text files where all lines end with \r\r\n ( 0x0D 0x0D 0x0A ). If I try to read such file with fread() , it says Line ending is \r\r\n. R's download.file() appears to add the extra \r in text mode on Windows. Please download again in binary mode (mode='wb') which might be faster too. Alternatively, pass the URL directly to fread and it will download the file in binary mode for you. but I am not downloading these files, I already have them. So far I came to the