-1

I have all and the same problems with encoding text files that everyone has. I work with linux terminal (gnome-terminal) and with and ssh connection to a linux server, my clients have OSX and MS Windows 7 and 10, and they are server for a webservice that i didn't know, but they alway sent me text files that can't be processed by my scripts (bash scripts) because encoding problems. The solution is so simple: i make:

cat textfile

Then i select the text in the terminal and with vim just paste the output.

So, my question is:

cat is not affected by encoding? Or is vim? or is gnome-terminal the one who cares a sh$%6 about the encoding?

X3MBoy
  • 203
  • 4
  • 12
  • 4
    `cat` simply copies the bytes of the file to standard output. Interpretation is up to the device/emulator. – Barmar Apr 04 '16 at 21:08

1 Answers1

2

When you're selecting the text in the terminal only the text and the regular line endings gets selected and copied. cat has nothing to do with it as Barmar commented.

If you're using vim you change line ending with :set ff=unix and save (:wq).
If the encoding is messed up that can be fixed with :set fileencoding=utf-8 or what encoding you use.

micke
  • 899
  • 9
  • 23
  • I didn't know about these options in set (ff and dileconding). Those work perfectly with messed up files. Thanks – X3MBoy Apr 11 '16 at 19:24