Question

what I want to do is to be able to mount via sshfs some files on the mainframe via USS on my local PC. I can do that but sshfs doesnt do straight off the conversion from EBCDIC to ascii/unicode. Is there any flags that i can set.

Alternativly, does anybody know of a library that does EBCDIC to ASCII conversions so i can add to SSHFS?

Cheers

Mark

Was it helpful?

Solution

Be aware though that transparent charset conversion is a very dangerous game. Are you absolutely sure that you will never read anything but EBCDIC files via SSHFS? What if there is binary data?

Some systems used transparent conversions in the past:

  • the infamous "ASCII mode" of FTP, which messed up many binary downloads
  • the vfat filesystem in Linux, which notes: "Programs that do computed lseeks won't like in-kernel text conversion. Several people have had their data ruined by this translation. Beware!"

So I'd strongly advise to be aware of the consequences.

Why not use use an editor that can handle EBCDIC? Vim e.g. can do it (if it is compiled in).

OTHER TIPS

There are several libraries for character set conversion — iconv (normally part of your C library; see for example iconv_open) and GNU recode come to mind.

I know a lot of time has passed since the original question but I'll leave the info here:
I've wrote a patch for sshfs which adds automatic conversion between ASCII and EBCDIC. It can be found here: https://github.com/vadimshchukin/sshfs-ebcdic

The patch adds "-t" command-line option which defines regular expression for files that should be converted. For example sshfs -t".*" defines conversion for all files.

I had to "hard-code" the conversion table since there are various "flavours" of EBCDIC and iconv didn't translate the text between ASCII as EBCDIC on my system as needed. The advantage here is that someone can easily change that translation table as needed.

By the way I wrote the same patch for win-sshfs.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top