unix -> windows text transfer dropping embedded Ctrl-M

Advertisement

alfp
Joined:
Posts:
13
Location:
The University of Melbourne

unix -> windows text transfer dropping embedded Ctrl-M

When transferring a text file which contained an embedded Ctrl-M character not associated with any line terminator from unix to windows with SFTP protocol, the Ctrl-M character gets dropped. This does not occur when doing a text transfer on a similar file from windows to unix. I would have expected that Ctrl-M characters would only be stripped in a text transfer if associated with a line terminator, and then only for a transfer from windows to unix. Is this expected behaviour or is this a bug?

I am using WinSCP 4.0.6 (build 358) which I believe is the latest. I cannot verify if this also happens with FTP protocol as our unix hosts only accept SFTP connections.

Reply with quote

Advertisement

ransue
Joined:
Posts:
1

Re: unix -> windows text transfer dropping embedded Ctrl-M

martin wrote:

This has been fixed already. See tracker entry.

I get a "You do not have permission to access this document." from that page. Can you explain how to set up so ^Ms are not showing up on the unix side? I am on version 4.0.3 Build 345
Thx

Reply with quote

mikew
Guest

Re: unix -> windows text transfer dropping embedded Ctrl-M

martin wrote:

This has been fixed in 4.1 beta.

This is still happening for me. version 4.1.7

Reply with quote

Advertisement

alfp
Joined:
Posts:
13
Location:
The University of Melbourne

Re: unix -> windows text transfer dropping embedded Ctrl-M

mikew wrote:

martin wrote:

This has been fixed in 4.1 beta.

This is still happening for me. version 4.1.7

I have just re-tested my original case with SFTP protocol using both versions 4.1.6 & 4.1.7, and the Ctrl-M is not being dropped. Which protocol are you using?

Alf.

Reply with quote

Devendra Narvariya
Guest

CTRL+M char issue, WINSCP 4.3.5

When I transfer any file from windows to my AIX server CTRL+M character is displayed in every editable file when opened with VI editor. ALso such file do not get executed because of presence of this character, why CTRl+M character pops up while transferring the file. Is there any reason for this or its just a BUG.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,440
Location:
Prague, Czechia

Re: CTRL+M char issue, WINSCP 4.3.5

Devendra Narvariya wrote:

When I transfer any file from windows to my AIX server CTRL+M character is displayed in every editable file when opened with VI editor. ALso such file do not get executed because of presence of this character, why CTRl+M character pops up while transferring the file. Is there any reason for this or its just a BUG.
Is the character present in the source file? Depending on that, do you want WinSCP to transfer file intact (i.e. you believe WinSCP is adding the character [this is unlikely])? Or do you want WinSCP to strip the character when uploading? For that see:
https://winscp.net/eng/docs/transfer_mode

Reply with quote

Advertisement

Devendra Narvariya
Guest

Re: CTRL+M char issue, WINSCP 4.3.5

martin wrote:

Devendra Narvariya wrote:

When I transfer any file from windows to my AIX server CTRL+M character is displayed in every editable file when opened with VI editor. ALso such file do not get executed because of presence of this character, why CTRl+M character pops up while transferring the file. Is there any reason for this or its just a BUG.
Is the character present in the source file? Depending on that, do you want WinSCP to transfer file intact (i.e. you believe WinSCP is adding the character [this is unlikely])? Or do you want WinSCP to strip the character when uploading? For that see:
https://winscp.net/eng/docs/transfer_mode

I checked the files on Windows XP with various editors but CTRL+M character is not shown. But after file transfer those CTRL+M character appears when I use VI editor.


Regards

Devendra Narvariya

Reply with quote

martin
Site Admin
martin avatar

Re: CTRL+M char issue, WINSCP 4.3.5

Devendra Narvariya wrote:

I checked the files on Windows XP with various editors but CTRL+M character is not shown. But after file transfer those CTRL+M character appears when I use VI editor.
Have you tried some binary viewer?

Reply with quote

Devendra Narvariya
Guest

Re: CTRL+M char issue, WINSCP 4.3.5

martin wrote:

Devendra Narvariya wrote:

I checked the files on Windows XP with various editors but CTRL+M character is not shown. But after file transfer those CTRL+M character appears when I use VI editor.
Have you tried some binary viewer?

No. The editors I tried on Windows XP were Notepad,Notepad++,Windows 2003 office, WordPad.

Reply with quote

nooneinparticular
Guest

script to remove control M from files that Windows editors add to the end of every line

#!/bin/ksh
if [ "$1" = "" ]
then echo ""
echo "Parm 1 FileName (required)"
echo ""
return
else FileName="$1"
fi
cat ${FileName} | sed 's/.$//g' > ${FileName}.txt
chmod 770 ${FileName}.txt
mv ${FileName}.txt ${FileName}

Reply with quote

Advertisement

You can post new topics in this forum