Questions tagged [line-endings]

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

Filter by
Sorted by
Tagged with
2 votes
1 answer
74 views

How to find a substring index in a string with different line ending in Typescript

I have two strings abc\r\ndef c\nde And I need to find index of string 2 inside string 1. I can't obviously use indexOf(), so I need something that would work like it, but took different line ...
John dow's user avatar
  • 142
3 votes
0 answers
112 views

FormatMessageV() of CString replaces \n with \r\n

There is a function called as FormatMessageV which is part of CString class that is supposed to 'Format a message string using a variable argument list' according to MSDN. Other than the said ...
ZoomIn's user avatar
  • 1,273
1 vote
3 answers
67 views

Strings and here document have UNIX line endings on Windows

Both here documents and strings are using UNIX 0x0A line endings on Windows instead of 0x0D0A. How can I get them to be Windows line endings? PS C:\> $s = @" >> now >> is >> ...
lit's user avatar
  • 15k
1 vote
1 answer
106 views

How to prevent Python JSON .dumps() function from removing carriage return? [duplicate]

In Python, I'm attempting to read in a JSON file, change a single value, then do some further processing on the string returned from the .dumps() function. However, after calling json.dumps() the ...
cam.b's user avatar
  • 137
1 vote
1 answer
63 views

Intellij IDEA Unix line endings for new files

How do you configure Intellij IDEA so that it will use Unix line endings for all source files it creates in the future? The Google search results all refer to the way to convert an existing file to ...
rwallace's user avatar
  • 31.8k
0 votes
1 answer
231 views

How to fix the line ending style (either CRLF or LF) in Python when written a text file?

I have the following little program in Python from pathlib import Path filename = Path("file.txt") content = "line1\nline2\nline3\n" with filename.open("w+", encoding=&...
fgalan's user avatar
  • 11.9k
2 votes
1 answer
100 views

Where in the documentation/spec does it describe how '\n' is converted in text-mode to platform-specific line-endings?

I know, from experience, that the following code: #include <iostream> int main() { std::cout << "Hello World!\n"; return 0; } results in different line-endings being ...
Pod's user avatar
  • 3,954
5 votes
1 answer
117 views

Adding comma between quotes (format) in printf changes the output?

I am facing a very weird issue that i can only produce on linux. I really couldnt find anything like it on the internet, but if my searching skills are not good enough, I apologize if this was a ...
Daniel Boos's user avatar
3 votes
0 answers
57 views

Is there a way to set the default line ending for GitHub Copilot?

I am trying out GitHub Copilot on a project that uses CRLF for all line endings. Copilot often suggests other line endings (CR or LF). Is there a way to configure or tell Copilot to only use a certain ...
JasonC's user avatar
  • 183
1 vote
1 answer
39 views

Change Line Ending on File in GitHub Repo

GitHub supports Adding a file to a repository. How can the line endings be changed on an existing file in the repo with the GitHub gui? This is for an existing file in repo without cloning repo and ...
flywire's user avatar
  • 1,195
1 vote
1 answer
548 views

Is there a way to make the format option of Visual Studio use unix line endings?

It is possible to set the line endings for a file. This converts existing line endings, and works when adding a manual line break. However, it does not seem to insert the correct line endings when ...
Selmar's user avatar
  • 742
0 votes
1 answer
93 views

Release Pipeline task File Transform converts line endings to Unix

I am using File Transfrom in Azure DevOps to transform an application's appsettings.json file, with JSON option, in Release Pipeline. The transform occurs and replaces variables as expected. When ...
Matt Fricker's user avatar
2 votes
0 answers
119 views

New project in android studio sets line endings (line separators) to LF even if settings say CRLF

I followed the instructions here to set the default line separators of new projects to be CRLF. However, whenever I create a new project on android studio, they are always set to LF. When I open the ...
Kyle Angelo Gonzales's user avatar
1 vote
1 answer
131 views

git : nothing changed but mark every line "changed"

IDE : Eclipse & VS code Git tool : source tree, VS code Action : Nothing changed in my code. But when pressing ctrl+s, it's able to save and suorceTree will show every line has been edited. The ...
89barde's user avatar
  • 25
0 votes
1 answer
118 views

Why does my custom font on iOS cause leading characters to go missing (and not apply the font)?

On my Flutter app, I implemented a custom text theme using 2 fonts that I stored in assets/ as instructed here. (These instructions, while different, are also generally helpful.) I got everything ...
Ross Llewallyn's user avatar
0 votes
1 answer
272 views

Docker container fails on Windows Powershell succeeds on WSL2 with identical Dockerfile and docker-compose

Problem Description I have a docker image which I build and run using docker-compose. Normally I develop on WSL2, and when running docker-compose up --build the image builds and runs successfully. On ...
MadDanWithABox's user avatar
1 vote
0 answers
279 views

Is it OK to use `* -text diff` in .gitattributes?

We have a large collection of files we want to put in a Git repository. Line endings include LF, CRLF, and mixed LF/CRLF. It's important in our context to keep these files exactly as-is, byte-for-byte....
Jay Bazuzi's user avatar
  • 45.4k
0 votes
1 answer
42 views

Force mixed line endings in ViM

I have a Python file that is developed under Windows, so it naturally has CR LF line endings. I added the Python shebang on it using #!/usr/bin/env python3 to make it directly executable under Linux. ...
hochl's user avatar
  • 12.6k
-1 votes
1 answer
37 views

How to configure git line endings simple and minimal?

my assumption is that only in batch files windows line endings should be allowed. Everywhere else should be used the git internal mechanic to recognize binary files and all other text files should ...
jan's user avatar
  • 2,751
2 votes
1 answer
370 views

Editing .gitattributes to normalize line endings doesn't work?

I am trying to normalize line endings for my git repo, specifically, I am trying to make all .sh files use LF (Unix-style endings). When I researched about it, I figured out I should add this to my ....
Mary's user avatar
  • 161
2 votes
2 answers
88 views

Does CMD do CRLF translation?

Since Windows uses CRLF as native line endings, one might expect that code like this #include <windows.h> #include <string.h> int main() { HANDLE stdout = GetStdHandle(...
user19685524's user avatar
3 votes
1 answer
517 views

WSL: Ways to deal with bash script that was checked out on Windows

I don't know if I' missing something here, but this is my current situation: GIT Repo checked out on Windows machine Line endings are automatically converted (autocrlf = true) installed WSL with ...
Roland M's user avatar
1 vote
1 answer
368 views

How to check what lineending a StringIO file is using?

I had a method that detects line endings def getLineEnding(filename): ret = "\r\n" with open(filename, 'r') as f: f.readline() ret = f.newlines return ret In ...
klutt's user avatar
  • 30.6k
2 votes
1 answer
1k views

git apparently keeps saying that a file has been modified when it has not

I am experiencing a curious situation, probably related to this question, but I'd like to better understand what is going on here. I have a repository where right after a clone git status reports that ...
Danilo Pianini's user avatar
0 votes
5 answers
691 views

Remove line breaks followed by space in text file

I have a text file that contains data that I am trying to make more easily readable. Some of the lines, e.g. info 2 below, have the results over multiple lines, where there is a line break followed by ...
Sami's user avatar
  • 1
0 votes
0 answers
514 views

coc.nvim throwing error on startup of nvim after update "E15: Invalid expression: exists('g:did_coc_loaded') || v:version < 800^M"

I don't know what happened here, but before I did 'PlugInstall' everything was fine. now I'm getting this when starting up nvim: Error detected while processing /home/rcrod/.vim/plugged/coc.nvim/...
rodelcabs's user avatar
6 votes
2 answers
5k views

How to stop Github Desktop from changing my line endings

I'm pretty sure Github Desktop is changing my line endings when I commit the files, how do I turn this feature off? I'm using blazor and the files need to remain unchanged or they will fail blazors ...
Michael's user avatar
  • 111
4 votes
1 answer
1k views

Why is git showing line endings change although there should be none?

I have a file checked in as CRLF which should be CRLF as can be seen by: git ls-files --eol: i/crlf w/crlf attr/text eol=crlf src/Project.Tests/ReadTestsV4.cs But it is still showing a diff ...
Daniel Habenicht's user avatar
1 vote
1 answer
113 views

How can I use Perl for in-place-editing of files with Unix-EOL on Windows?

I am trying to use Perl's in-place-editing feature to change some text in files with Unix line endings in a PowerShell session on Windows: perl.exe -i'.bak' -p -e "s#PATTERN#REPLACEMENT#g" (...
René Nyffenegger's user avatar
27 votes
1 answer
25k views

How to set default line endings in Visual Studio Code?

I have an autosetting for Windows somewhere (CRLF) which is really annoying, is there a way to change this to Unix?
rACkle's user avatar
  • 503
3 votes
4 answers
232 views

How to add quotes from specific delimiter to end of the line, using awk?

I am trying to modify a file: (file.txt) abc~123~xyz~123456~12~0.12~14~1.1~ omn~124~xdz~923231~13~0.0~13~1.1~14~0.45~19~80.1~ to (new_file.txt) abc~123~xyz~123456~"12~0.12~14~1.1~" omn~...
dragon_fury_'s user avatar
0 votes
1 answer
792 views

How to read file having different line ending in C++

I have two files "linuxUTF8.srt" and "macANSI.srt". I am reading these files using getline(). as macANSI.srt has '\r' as line ending I am reading the whole file rather than a ...
Shubham Sharma's user avatar
1 vote
1 answer
851 views

Does text=auto in .gitattributes always enforce LF line endings and ignore Git's core.autocrlf and core.eol settings?

This is essentially a follow-up to the question asked here about the difference between * text=auto and * text=auto eol=lf in a .gitattributes config: What is the difference between "* text=auto&...
Aleksandr Hovhannisyan's user avatar
0 votes
0 answers
169 views

Change style of line endings with eclipse code formatter

I am working with windows, using IntelliJ and the eclipse code formatter. My problem is, that I want to have only Unix style line endings in my projekt. IntelliJ has the option to use that, but if I ...
Ludy's user avatar
  • 1
0 votes
1 answer
298 views

git rebase drops commit that only contains line-ending changes

I am trying to rebase a branch that contains a commit that fixes the line endings of some files (by making them LF instead of CRLF). If I try to do an ordinary rebase git rebase origin/develop I get ...
Robin Green's user avatar
  • 32.3k
2 votes
0 answers
306 views

Windows angular need to create files with CRLF endings

I'm on windows and want in my angular project the cli to create components with CRLF endings. Right now angular CLI creates scss file with CRLF and other files (ts, html and test) with LF. In my ...
Олег Войтинський's user avatar
0 votes
2 answers
2k views

What is the difference between crlf and lf in effects and meaning?

I know the difference between line feed and carriage return. Carriage return moves the cursor at the beginning of the line and line feed moves the cursor to next without going to begin of that line. ...
RajinCoding2007's user avatar
2 votes
2 answers
753 views

Confused about how to handle line endings in git repo

I have some basic knowledge about core.autocrlf and text in .gitattributes Still I had stuck with my scenario. Scenario In all my editors I use CR LF, so when I modify a file it will be saved with CR ...
g.pickardou's user avatar
3 votes
2 answers
4k views

Terraform keeps changing line endings of the multi-line heredoc depending on the runtime environment

I have this terraform resource (a bit simplified for clarity): resource "azurerm_key_vault_secret" "env_secrets" { name = "my-secret" key_vault_id = var....
Ilya Chernomordik's user avatar
4 votes
0 answers
2k views

VSCode saving changes line endings to CRLF

I am currently trying to standardize my line endings to LF, whilst working in Windows. I have eslint and prettier set up in my project. These extensions are enforcing the consistent line endings in ...
David Jentjens's user avatar
2 votes
3 answers
311 views

MSVC C++ compiler option to prevent replacing LF by CR LF in ostream/ofstream

I'm using Microsoft Visual Studio 2017's command line tools such as cl.exe to compile C++ codes. Instructions to output line breaks like std::cout << "abc" << std::endl; or std::...
A.Sugiyama's user avatar
0 votes
1 answer
34 views

Turtle is not running

import turtle t = turtle.Turtle() t.right(100) t.done() That is my code, but there is no result after run. Why this problem is arising and what can I do now?
Amlan's user avatar
  • 1
2 votes
1 answer
642 views

Newlines from a background process aren't working while ssh is running

I have a process that prints some lines of text running in the background. If I start ssh, the newline characters don't work properly. user@localhost:~$ { sleep 5; echo -e "1\n2\n3" ; } &...
jozxyqk's user avatar
  • 16.6k
-3 votes
2 answers
77 views

Why is PHP explode keeping the \n? [closed]

Under Linux, I'm submitting a form containing text with \n as the line ending. That's the HTML: <form id='frmTxt' autocomplete='off' method='post' action='index.php'> <p>Paste your ...
Rodrigo's user avatar
  • 4,796
0 votes
1 answer
79 views

Can KEDIT respect per-file line endings?

By default, the KEDIT text editor (the Mansfield Software Group one) adds windows-style CRLF line endings on all files, including unix-style LF files. How can I configure KEDIT to respect the existing ...
bscan's user avatar
  • 2,846
0 votes
1 answer
934 views

Converting csv to json adds '\r' characters

I have a method that converts csv to json data: Here is the code: CSV2JSON(): void { const lines = this.csvData.split('\n'); const result = []; const headers = lines[0].split(',')...
yea2021's user avatar
  • 67
2 votes
1 answer
213 views

git line endings behavior does not match documentation

I'm seeing git do things with line endings which seems to contradict everything I've seen on this site and the official docs and even its own warning messages. (Or maybe I fail at reading ...
Mark VY's user avatar
  • 1,559
0 votes
0 answers
79 views

C one-liner to split a string into lines, tolerating CR, LF, and CR+LF

I was thinking today about how lame it is when programs don't tolerate the three major line break formats (CR, LF, CR+LF), and wondering why so many developers fail to tolerate files from other ...
Andy's user avatar
  • 8,093
5 votes
1 answer
3k views

Line endings are not following default settings in VS Code

When I try to push to GitHub, everytime I keep getting such warnings: warning: LF will be replaced by CRLF in app/bingey-api/models/user.js. The file will have its original line endings in your ...
vytaute's user avatar
  • 1,310
3 votes
4 answers
202 views

Why the line terminator `\r\n` causes groups not to be matched?

I'm working on text files with Windows line terminators (\r\n), on Linux with Perl v5.30. Something that I don't understand is why, with these text files, capturing groups don't match characters, ...
Marcus's user avatar
  • 5,168

1
2 3 4 5
11