Hidden characters when pasting in vi/vim

Hello everyone.

When I copy some configuration settings string from MS_Word to putty from my personal pc to a remote machine, it appears that I copy some hidden symbols, which at first, cannot be seen and appear as hidden. Some java programs did not start, and after investigation I found that:

  • After I use cat -vt config.file hidden symbol is revealed. In vi mode, I tried using :set list with no success, so in vi mode everything appears as copied normally but the hidden symbol cannot be seen.

Is there a way to see directly in vi, if I have copied such hidden symbols? Maybe I should change my putty's font?

Additional info
I am using W10 with standard English language settings. Strange thing is that I copy the same text to a notepad++ and with an ansi encoding, it does not get detected also, when I change it to utf-8, the hidden symbol appears.

Thanks in advance for everyone`s time and attention.

It generally is not a good idea to edit *nix configuration files on windows systems, and even less so with WORD, as it will stuff the file with formatting info on top of MS's DOS line terminators (\r or 0x0D) found in any text files.
Use text editors instead, of which some can be switched to "UNIX" mode, so you wouldn't need to worry.
You're best off if you edit text files intended for *nix systems on the target host.

Hi RudiC, thanks for the answer. I generally avoid editing nix files on Windows, although If I happen to do it, I use dos to unix file converter app.
However, in this particular case, I just copy random string from my system to a remote system via putty and vi editor.

By the way, which editors would you recommend that can switch to unix mode?

I'm running a windows-free environment, so I can't really help. Quite some time ago, I was very happy using "EDITPAD Lite".

To remove undesired characters from a file that go beyond the action of the dos2unix tool, there exist different tools and approaches, e.g.

tr -dc '[[:alnum:][:punct:][:space:]]' <file

, or a quick sed or awk script.