I have to use ange-ftp because the server I'm connecting to doesn't run ssh. When I transfer, it uses binary, which does not work. The server is a mainframe and likely uses ebcdic.
If I ftp from the command line in ascii mode, the file comes over to Windows correctly. If I enter the commands by hand in the ange-ftp, setting ascii, it works.
How do I tell ange-ftp to use ascii?
I set ange-ftp-binary-file-name-regexp to "", even though the .cpp file wasn't in the regexp.
Here's a trace.
quote mdtm /SYSTEM/home/suimgvb/ken/utils.cpp
501 command aborted -- FTP server not configured for MDTM
type binary
200 Representation type is Image
get /SYSTEM/home/suimgvb/ken/utils.cpp c:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/ange-ftp4280SMK
200 Port request OK.
125 Sending data set /SYSTEM/home/suimgvb/ken/utils.cpp
250 Transfer completed successfully.
ftp: 1407 bytes received in 0.01Seconds 93.80Kbytes/sec.
type ascii
200 Representation type is Ascii NonPrint
quote mdtm /SYSTEM/home/suimgvb/ken/utils.cpp
501 command aborted -- FTP server not configured for MDTM
> From: Ken Goldman <kg...@watson.ibm.com>
> Date: Fri, 10 Feb 2012 16:55:49 -0500
> I have to use ange-ftp because the server I'm connecting to doesn't run > ssh. When I transfer, it uses binary, which does not work. The server > is a mainframe and likely uses ebcdic.
Are you using ange-ftp via "C-x C-f"? If so, tell Emacs to decode the
file, as in "C-x RET c ebcdic-us RET C-x C-f whatever RET".
If you use some other command, again prefix that command with
universal-coding-system-argument ("C-x RET c") to tell it to use
EBCDIC, or whatever is right for those files.
IOW, just imagine the file was on your local disk, and do the same.
You cannot tell disk I/O to "use ascii", can you?
Ken Goldman <kg...@watson.ibm.com> writes:
> I have to use ange-ftp because the server I'm connecting to doesn't
> run ssh. When I transfer, it uses binary, which does not work. The
> server is a mainframe and likely uses ebcdic.
> If I ftp from the command line in ascii mode, the file comes over to
> Windows correctly. If I enter the commands by hand in the ange-ftp,
> setting ascii, it works.
> How do I tell ange-ftp to use ascii?
> I set ange-ftp-binary-file-name-regexp to "", even though the .cpp
> file wasn't in the regexp.
`ange-ftp-binary-file-name-regexp' tells, which files are to be
transferred in binary mode. "" matches ALL files. So you must set it to
a regexp, which doesn't match any file name, like "^$" (which is the
empty file name).
>> I have to use ange-ftp because the server I'm connecting to doesn't
>> run ssh. When I transfer, it uses binary, which does not work. The
>> server is a mainframe and likely uses ebcdic.
>> If I ftp from the command line in ascii mode, the file comes over to
>> Windows correctly. If I enter the commands by hand in the ange-ftp,
>> setting ascii, it works.
>> How do I tell ange-ftp to use ascii?
>> I set ange-ftp-binary-file-name-regexp to "", even though the .cpp
>> file wasn't in the regexp.
> `ange-ftp-binary-file-name-regexp' tells, which files are to be
> transferred in binary mode. "" matches ALL files. So you must set it to
> a regexp, which doesn't match any file name, like "^$" (which is the
> empty file name).
I tried this, but it still transfers in binary.
~~~~~~~~
ange-ftp-binary-file-name-regexp is a variable defined in `ange-ftp.el'.
Its value is "^$"
~~~~~~~~~~
ftp trace:
~~~~~~~~~~
quote mdtm /SYSTEM/home/suimgvb/ken/client.cpp
501 command aborted -- FTP server not configured for MDTM
type binary
200 Representation type is Image
get /SYSTEM/home/suimgvb/ken/client.cpp c:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/ange-ftp5768MyT
200 Port request OK.
125 Sending data set /SYSTEM/home/suimgvb/ken/client.cpp
250 Transfer completed successfully.
ftp: 38381 bytes received in 0.08Seconds 485.84Kbytes/sec.
type ascii
200 Representation type is Ascii NonPrint
quote mdtm /SYSTEM/home/suimgvb/ken/client.cpp
501 command aborted -- FTP server not configured for MDTM
>> From: Ken Goldman<kg...@watson.ibm.com>
>> Date: Fri, 10 Feb 2012 16:55:49 -0500
>> I have to use ange-ftp because the server I'm connecting to doesn't run
>> ssh. When I transfer, it uses binary, which does not work. The server
>> is a mainframe and likely uses ebcdic.
> Are you using ange-ftp via "C-x C-f"? If so, tell Emacs to decode the
> file, as in "C-x RET c ebcdic-us RET C-x C-f whatever RET".
> If you use some other command, again prefix that command with
> universal-coding-system-argument ("C-x RET c") to tell it to use
> EBCDIC, or whatever is right for those files.
> IOW, just imagine the file was on your local disk, and do the same.
> You cannot tell disk I/O to "use ascii", can you?
I tried this and it is somewhat better. I can see the text but all the newline appears as \205, [ as \255 and ] as \275.
I think I simply want to tell ange-ftp to use ascii, not binary, but nothing I tried works.
> I have to use ange-ftp because the server I'm connecting to doesn't run
> ssh. When I transfer, it uses binary, which does not work. The server is
> a mainframe and likely uses ebcdic.
> If I ftp from the command line in ascii mode, the file comes over to
> Windows correctly. If I enter the commands by hand in the ange-ftp,
> setting ascii, it works.
> How do I tell ange-ftp to use ascii?
Following up my own post, I edited ange-ftp.el and changed 'binary' to 'ascii'. Files now come across absolutely perfectly.
I know that's an awful hack, but it's a proof of concept. Now, how do I convince ange-ftp to use ascii without editing the elisp source?
> I know that's an awful hack, but it's a proof of concept. Now, how do
> I convince ange-ftp to use ascii without editing the elisp source?
I don't think we provide such a feature: Emacs is usually much better at
handling various forms of text representations than FTP. Obviously, not
in your case, because it seems that the file you're transferring is using
a format that Emacs does not know.
If you can figure out what that format is, we could easily add the
corresponding coding-system to Emacs.
Ken Goldman <kg...@watson.ibm.com> writes:
> On 2/10/2012 4:55 PM, Ken Goldman wrote:
>> I have to use ange-ftp because the server I'm connecting to doesn't run
>> ssh. When I transfer, it uses binary, which does not work. The server is
>> a mainframe and likely uses ebcdic.
>> If I ftp from the command line in ascii mode, the file comes over to
>> Windows correctly. If I enter the commands by hand in the ange-ftp,
>> setting ascii, it works.
>> How do I tell ange-ftp to use ascii?
> Following up my own post, I edited ange-ftp.el and changed 'binary' to
> ascii'. Files now come across absolutely perfectly.
> I know that's an awful hack, but it's a proof of concept. Now, how do
> I convince ange-ftp to use ascii without editing the elisp source?
Which Emacs version are you running?
Last year, there was a bug report about ange-ftp's binary mode, see
<http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7383>. IIRC, it was about
ange-ftp always using binary mode, when your local system is MS
Windows. This is fixed meanwhile.
Chances are good, that a prerelease of Emacs 24.1 works for you out-of-the-box.
>> On 2/10/2012 4:55 PM, Ken Goldman wrote:
>>> I have to use ange-ftp because the server I'm connecting to doesn't run
>>> ssh. When I transfer, it uses binary, which does not work. The server is
>>> a mainframe and likely uses ebcdic.
>>> If I ftp from the command line in ascii mode, the file comes over to
>>> Windows correctly. If I enter the commands by hand in the ange-ftp,
>>> setting ascii, it works.
>>> How do I tell ange-ftp to use ascii?
>> Following up my own post, I edited ange-ftp.el and changed 'binary' to
>> ascii'. Files now come across absolutely perfectly.
>> I know that's an awful hack, but it's a proof of concept. Now, how do
>> I convince ange-ftp to use ascii without editing the elisp source?
> Which Emacs version are you running?
> Last year, there was a bug report about ange-ftp's binary mode, see
> <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7383>. IIRC, it was about
> ange-ftp always using binary mode, when your local system is MS
> Windows. This is fixed meanwhile.
> Chances are good, that a prerelease of Emacs 24.1 works for you out-of-the-box.
I looked at the bug reports, but they seem to be cases where people __wanted__ binary mode. I have the opposite issue. I always want ASCII mode so ftp will do the EBCDIC <-> ASCII conversion.
I'm running 23.1.1. I won't risk a pre-release when I have a source code hack that works. I'll retest when 24 goes into production.