Loading ...
Sorry, an error occurred while loading the content.

Re: Using vim/gvim to edit EBCDIC on Windows

Expand Messages
  • Wayne Johnson
    Thanks for the suggestion. I tried dd (sorry, should have mentioned it earlier), and it seems to do some really strange translations. Somehow the EBCDIC
    Message 1 of 4 , Dec 1, 2004
    • 0 Attachment
      Thanks for the suggestion.

      I tried dd (sorry, should have mentioned it earlier), and it seems to do
      some really strange translations. Somehow the EBCDIC newline character
      comes out as an 0x85?

      I haven't found a better ascii/ebcdic translator in cygwin. I know it
      supports iconv, just not found a way to call it. Guess a perl script
      would work here.

      Anyway to call iconv directly from vim scripts?

      --- drchip@... wrote:

      > Quoting Wayne Johnson <wdtj@...>:
      >
      > > Occasionally, I have the need to edit an EBCDIC file on my PC (W2k).
      > > I've seen many reverences to support for EBCDIC on OS390, but nothing
      > for
      > > a PC.
      > >
      > > Anyone have a way to do this? Maybe a script to translate from and
      > to?
      >
      > " editing EBCDIC {{{2
      > au BufReadPost */EBCDIC/* :%!dd conv=ascii
      > au BufWritePre */EBCDIC/* :%!dd conv=ebcdic
      >
      > If you have cygwin on your pc, and you can get it for free from the
      > web (juse do a google search for cygwin), you'll be provided with
      > the "dd" conversion utility.
      >
      > The two autocmds above trigger when EBCDIC is on the path. So, if you
      > make a EBCDIC directory to hold such files, then you can use vim
      > to edit with them.
      >
      > Enjoy!
      > Chip Campbell
      >
      >
      >

      =====
      ---
      Wayne Johnson, | There are two kinds of people: Those
      3943 Penn Ave. N. | who say to God, "Thy will be done,"
      Minneapolis, MN 55412-1908 | and those to whom God says, "All right,
      (612) 522-7003 | then, have it your way." --C.S. Lewis



      __________________________________
      Do you Yahoo!?
      All your favorites on one personal page � Try My Yahoo!
      http://my.yahoo.com
    • drchip@campbellfamily.biz
      ... I suspect it has to do with whether or not vim is in binary mode or not. Anyway, here are some autocmds using iconv which set/unset binary mode to keep
      Message 2 of 4 , Dec 1, 2004
      • 0 Attachment
        Quoting Wayne Johnson <wdtj@...>:

        > Thanks for the suggestion.
        >
        > I tried dd (sorry, should have mentioned it earlier), and it seems to do
        > some really strange translations. Somehow the EBCDIC newline character
        > comes out as an 0x85?

        I suspect it has to do with whether or not vim is in binary mode or not.
        Anyway, here are some autocmds using iconv which set/unset binary
        mode to keep ebcdic and ascii in their appropriate places.

        " editing EBCDIC {{{2
        au BufReadPre */EBCDIC/*,*.ebcdic :let g:binkeep= &bin|set bin
        au BufReadPost */EBCDIC/*,*.ebcdic :%!iconv -f EBCDIC-US
        au BufReadPost */EBCDIC/*,*.ebcdic :let &bin= g:binkeep|unlet g:binkeep
        au BufWritePre */EBCDIC/*,*.ebcdic :let g:binkeep= &bin|set bin|%!iconv -t
        EBCDIC-US
        au BufWritePost */EBCDIC/*,*.ebcdic :let &bin= g:binkeep|unlet g:binkeep>

        Regards,
        Chip Campbell
      Your message has been successfully submitted and would be delivered to recipients shortly.