Is there a way to change the character encoding of a text file? If so, how?
See, I am using a keyboard shortcut to call a shell command which itself uses xclip to copy the contents of a file into the clipboard. I can then use CTRL + V to paste the contents. I am doing this to add the signature to email whenever I need.
This is the script:
#!/bin/sh
# Need to install xclip
cat ~/personal/mail-signature.txt | xclip -i -selection clipboard
It all seems to work correctly, even on the e-mail composition window. However, when the message is sent the carriage return (new line characters) seem to have been doubled as compared to the file. That is, regardless what I use in gedit to add the new line (ENTER, SHIFT+ENTER, or CTRL+ENTER) the all turn this:
+-------------------------++------------------------+
My name and address. Affiliation
fax: +1 (5555) 555-5555 Address in this planet
my_email@someaddress.ca http://www.someaddress.ca/
+-------------------------++------------------------+
into this
+-------------------------++------------------------+
My name and address. Affiliation
fax: +1 (5555) 555-5555 Address in this planet
my_email@someaddress.ca http://www.someaddress.ca/
+-------------------------++------------------------+
once the message is sent.
This does not seem to happen when I open the signature file in gedit and use CTRL+C and CTRL+V on my e-mail client's window.
I am guessing it must be the way xclip read/interprets the end of line / new line character but for some reason the client's editing window does not show the difference while the server (Gmail's smtp server in this case) does seem see the difference between the end of line characters.
I am using Ubuntu 16.04 and Thunderbird 45.3.0 as the e-mail client.
Update: Just tried xclip with option -noutf8 but did not work either.