Why does editing a FreeNAS script/text file on a Windows PC cause issues when copied to NAS?

Why does editing a FreeNAS script/text file on a Windows PC cause issues when copied to NAS?

Status
Not open for further replies.

Hazimil

Contributor
Joined
May 26, 2014
Messages
172
Hazimil submitted a new resource:

Why does editing a FreeNAS script/text file on a Windows PC or Mac cause issues when copied to NAS? - FreeBSD treats the end-of-line character different than Windows/DOS and Macs.

I've seen this come up a couple of times now, so I decided to post a resource about it.

Background:
When people copy a script/text file to their FreeNAS server which was created (or downloaded) on their Windows PC or Mac, the script sometimes fails to run correctly or displays weird characters at the end of each line, i.e. ^M.

This is often due to the fact that UNIX (including Linux and FreeBSD), Windows/DOS, and Macs all treat the newline encoding in a text file...

Read more about this resource...
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194
Non-OS X user here. Are you sure that OS X uses CR? I fully expect it to use LF due its BSD roots.
 

Stux

MVP
Joined
Jun 2, 2016
Messages
4,419
I edit scripts on my Darwin BSD (ahem macOS) box all the time.

macOS has used LF 'forever' now. The problem is windows and windows only at this stage.

It is correct to say Classic MacOS used CR, but OSX does not. Bit like talking about Windows 95.
 

Hazimil

Contributor
Joined
May 26, 2014
Messages
172
Non-OS X user here. Are you sure that OS X uses CR? I fully expect it to use LF due its BSD roots.

Ooops, you are correct, sorry seems my Mac knowledge is out-of-date. Have corrected it.

Perhaps if I read the Wikipedia link I posted I would have noticed that! :)

Jonathan
 

pschatz100

Guru
Joined
Mar 30, 2014
Messages
1,184
Good explanation, but I think it would be worthwhile to clearly point out that Notepad++, mentioned in the resource, is NOT the same application as Notepad that is included with Windows. This may not be obvious to folks who are new to this issue.
 

Hazimil

Contributor
Joined
May 26, 2014
Messages
172
Good explanation, but I think it would be worthwhile to clearly point out that Notepad++, mentioned in the resource, is NOT the same application as Notepad that is included with Windows. This may not be obvious to folks who are new to this issue.

Good point, I will do an edit making this clear.

Jonathan
 

rvassar

Guru
Joined
May 2, 2018
Messages
972

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194
So, Notepad will finally support Windows, Unix and retarded line endings.
 

MrToddsFriends

Documentation Browser
Joined
Jan 12, 2015
Messages
1,338
Even the default registry (!) settings seem to be reasonable on first sight. Not bad, but more than 20 years late for the default "Windows NT" text editor.
 

Hazimil

Contributor
Joined
May 26, 2014
Messages
172
Status
Not open for further replies.
Top