sshfs EBCDIC 转 ASCII

发布于 2024-07-16 19:21:09 字数 206 浏览 4 评论 0 原文

我想要做的是能够通过 sshfs 通过 USS 在我的本地 PC 上挂载主机上的一些文件。 我可以做到这一点,但 sshfs 不能直接完成从 EBCDIC 到 ascii/unicode 的转换。 有没有我可以设置的标志。

或者,有人知道有一个库可以将 EBCDIC 转换为 ASCII 以便我可以添加到 SSHFS 吗?

干杯

马克

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

泛滥成性 2024-07-23 19:21:09

请注意,透明的字符集转换是一个非常危险的游戏。 您是否绝对确定您不会通过 SSHFS 读取除 EBCDIC 文件之外的任何内容? 如果有二进制数据怎么办?

过去一些系统使用透明转换:

  • 臭名昭著的 FTP 的“ASCII 模式”,它搞乱了
  • Linux 中 vfat 文件系统的许多二进制下载,其中指出:“执行计算 lseek 的程序不喜欢内核内文本转换。人们的数据被这种翻译破坏了!”

因此,我强烈建议您了解后果。

为什么不使用可以处理 EBCDIC 的编辑器? Vim 例如可以做到这一点(如果它被编译)。

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).

两人的回忆 2024-07-23 19:21:09

有几个用于字符集转换的库 - iconv(通常是 C 库的一部分;请参阅 iconv_open 示例)和 GNU 重新编码

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.

初见终念 2024-07-23 19:21:09

我知道自最初的问题以来已经过去了很多时间,但我将在此处留下信息:
我为 sshfs 编写了一个补丁,它添加了 ASCII 和 EBCDIC 之间的自动转换。 可以在这里找到: https://github.com/vadimshchukin/sshfs-ebcdic

补丁添加“-t”命令行选项,该选项定义应转换的文件的正则表达式。 例如sshfs -t".*"
定义所有文件的转换。

我必须对转换表进行“硬编码”,因为 EBCDIC 有多种“风格”,并且 iconv 没有根据需要在我的系统上将 ASCII 之间的文本转换为 EBCDIC。 这样做的优点是有人可以根据需要轻松更改该转换表。

顺便说一句,我为 win-sshfs 编写了相同的补丁。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文