Skip to content
Advertisement

How to disable encoding in a text-editor?

This is such a basic question I am surprised I could not easily find an answer to it:

I use Notepad++ to write my scripts in. Someone sent me some code for a shell script (.sh) that I could modify to suit my needs. I simply changed a small bit of text using Notepad++ (on Windows) and used FileZilla (SFTP) to upload it to my server (Debian Linux).

There were a few problems with this that it took my server admin an hour to find, namely:

  • FileZilla, for whatever reason, defaults to ASCII rather than binary! (changed it to binary and removed the .sh association with ASCII)
  • The permissions were wrong, chmod took care of this

Problem is it STILL did not work. To fix it my server admin simply copied the text right on the server (using vim or nano) into a new shell script file and saved that. Before he kept saying the problem was Windows (which he loves to hate on) but it seems it is the encoding that text-editors are using that is corrupting the files.

He said my text-editor encoding needs to be said to “None”. However, that is not an option – only ANSI, UTF and UTS variants are options!

How can I create a shell script on Windows with no encoding whatsoever so that it doesn’t get corrupted?

I need to be able to simply transfer the file to the server, I can’t mess around with modifying it once on the server which is wholly impractical.

Advertisement

Answer

To fix it EndOfLine and encoding on Notepad++ :

On the bottom right of Notepad++ you can right click on the left of the encoding “UTF-8” and click on Convert UNIX(LF) format. Be sure to change encoding to UTF-8 if it is not the case.

In Filezilla :

Transfert mode : auto

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement