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

VIM/Win32 Console/Character Encoding

Expand Messages
  • Swen Stsop
    I can t seem to get certain characters to show up correctly when I use vi for Win32 console. For example I cannot seem to see a copyright character, looks
    Message 1 of 4 , Feb 24, 2004
    • 0 Attachment
      I can't seem to get certain characters to show up
      correctly when I use vi for Win32 console. For
      example I cannot seem to see a copyright character,
      looks like this, ���, not this ��. If I use gvim it
      works just fine. (So I know its stored correctly.)
      It either doesn't work (probably not) or I'm just not
      getting it. edit.exe shows the same thing. Does it
      have to do with how cmd emulates?

      Thanks in advance.

      __________________________________
      Do you Yahoo!?
      Yahoo! Mail SpamGuard - Read only the mail you want.
      http://antispam.yahoo.com/tools
    • Antoine J. Mechelynck
      ... Your problem is with the Dos codepage. To find out which codepage is set, use MODE CON in a Dos Box. You ll get several lines of information. What is of
      Message 2 of 4 , Feb 24, 2004
      • 0 Attachment
        Swen Stsop <stsopswen4@...> wrote:
        > I can't seem to get certain characters to show up
        > correctly when I use vi for Win32 console. For
        > example I cannot seem to see a copyright character,
        > looks like this, â? , not this ©. If I use gvim it
        > works just fine. (So I know its stored correctly.)
        > It either doesn't work (probably not) or I'm just not
        > getting it. edit.exe shows the same thing. Does it
        > have to do with how cmd emulates?
        >
        > Thanks in advance.
        >
        > __________________________________
        > Do you Yahoo!?
        > Yahoo! Mail SpamGuard - Read only the mail you want.
        > http://antispam.yahoo.com/tools

        Your problem is with the Dos codepage. To find out which codepage is set,
        use "MODE CON" in a Dos Box. You'll get several lines of information. What
        is of interest is the "active code page". Some of the most frequent are 437
        (or US) and 850 (or International). I don't know if either of them (and
        which one) includes the copyright symbol. To change that would require (at
        least in the W98 system I use) changing a COUNTRY line (and possibly a
        DEVICE line for DISPLAY.SYS) in C:\CONFIG.SYS and two MODE CON CP lines in
        C:\AUTOEXEC.BAT.

        Gvim, OTOH, can use the Windows codepage (such as 1250) or even Unicode,
        and, AFAIK, neither of them is available in the Dos box (and thus, to the
        console version of vim). Some of the characters in the upper half (0x80 -
        0xFF) differ, and in addition, Unicode goes a helluva lot farther up than
        0xFF.

        Best regards,
        Tony.
      • Swen Stsop
        ... I ve gotten that far and you ve helped me confirm what I have to do. I was able to do chcp 1252 and everything seems fine. Now I just have the shortcut
        Message 3 of 4 , Feb 24, 2004
        • 0 Attachment
          --- "Antoine J. Mechelynck"
          <antoine.mechelynck@...> wrote:
          > Swen Stsop <stsopswen4@...> wrote:
          > > I can't seem to get certain characters to show up
          > > correctly when I use vi for Win32 console. For
          > > example I cannot seem to see a copyright
          > character,
          > > looks like this, �? , not this ��. If I use gvim
          > it
          > > works just fine. (So I know its stored
          > correctly.)
          > > It either doesn't work (probably not) or I'm just
          > not
          > > getting it. edit.exe shows the same thing. Does
          > it
          > > have to do with how cmd emulates?
          > >
          > > Thanks in advance.
          > >
          > > __________________________________
          > > Do you Yahoo!?
          > > Yahoo! Mail SpamGuard - Read only the mail you
          > want.
          > > http://antispam.yahoo.com/tools
          >
          > Your problem is with the Dos codepage. To find out
          > which codepage is set,
          > use "MODE CON" in a Dos Box. You'll get several
          > lines of information. What
          > is of interest is the "active code page". Some of
          > the most frequent are 437
          > (or US) and 850 (or International). I don't know if
          > either of them (and
          > which one) includes the copyright symbol. To change
          > that would require (at
          > least in the W98 system I use) changing a COUNTRY
          > line (and possibly a
          > DEVICE line for DISPLAY.SYS) in C:\CONFIG.SYS and
          > two MODE CON CP lines in
          > C:\AUTOEXEC.BAT.
          >
          > Gvim, OTOH, can use the Windows codepage (such as
          > 1250) or even Unicode,
          > and, AFAIK, neither of them is available in the Dos
          > box (and thus, to the
          > console version of vim). Some of the characters in
          > the upper half (0x80 -
          > 0xFF) differ, and in addition, Unicode goes a
          > helluva lot farther up than
          > 0xFF.
          >
          > Best regards,
          > Tony.
          >
          >

          I've gotten that far and you've helped me confirm what
          I have to do. I was able to do chcp 1252 and
          everything seems fine. Now I just have the shortcut
          to cmd.exe execute chcp 1252 before I start.

          Thanks.



          __________________________________
          Do you Yahoo!?
          Yahoo! Mail SpamGuard - Read only the mail you want.
          http://antispam.yahoo.com/tools
        • George V. Reilly
          ... Hmm. Vim.exe is implicitly using WriteConsoleOutputCharacterA to write characters to the console window, which means that it s limited to an 8-bit
          Message 4 of 4 , Feb 24, 2004
          • 0 Attachment
            "Swen Stsop" <stsopswen4@...> wrote:
            > "Antoine J. Mechelynck" wrote:
            > > Swen Stsop <stsopswen4@...> wrote:
            > > > I can't seem to get certain characters to
            > > > show up correctly when I use vi for Win32
            > > > console. For example I cannot seem to see a
            > > > copyright character, looks like this, â? ,
            > > > not this ©. If I use gvim it works just
            > > > fine. (So I know its stored correctly.) It
            > > > either doesn't work (probably not) or I'm
            > > > just not getting it. edit.exe shows the same
            > > > thing. Does it have to do with how cmd
            > > > emulates?
            > >
            > > Your problem is with the Dos codepage. To find
            > > out which codepage is set, use "MODE CON" in a
            > > Dos Box. You'll get several lines of
            > > information. What is of interest is the
            > > "active code page". Some of the most frequent
            > > are 437 (or US) and 850 (or International). I
            > > don't know if either of them (and which one)
            > > includes the copyright symbol. To change that
            > > would require (at least in the W98 system I
            > > use) changing a COUNTRY line (and possibly a
            > > DEVICE line for DISPLAY.SYS) in C:\CONFIG.SYS
            > > and two MODE CON CP lines in C:\AUTOEXEC.BAT.
            > >
            > > Gvim, OTOH, can use the Windows codepage (such
            > > as 1250) or even Unicode, and, AFAIK, neither
            > > of them is available in the Dos box (and thus,
            > > to the console version of vim). Some of the
            > > characters in the upper half (0x80 - 0xFF)
            > > differ, and in addition, Unicode goes a
            > > helluva lot farther up than 0xFF.
            >
            > I've gotten that far and you've helped me confirm what
            > I have to do. I was able to do chcp 1252 and
            > everything seems fine. Now I just have the shortcut
            > to cmd.exe execute chcp 1252 before I start.

            Hmm. Vim.exe is implicitly using
            WriteConsoleOutputCharacterA to write characters
            to the console window, which means that it's
            limited to an 8-bit character set drawn from the
            current code page. Vim.exe never explicitly sets
            the code page with SetConsoleCP (input) or
            SetConsoleOutputCP. I suppose that the Win32
            console binary could start honoring the
            'encoding' option.

            There is a wide-character version called
            WriteConsoleOutputCharacterW that supports the
            full Unicode repertoire. This is not directly
            supported on Win9x, unless you have the Microsoft
            Layer for Unicode (MSLU) binaries installed.

            --
            Public opinion is just what people think other people are thinking.
            (Get Witty Auto-Generated Signatures from http://SmartBee.org)
            George V. Reilly george@...
            http://george.reilly.org/
            Read my weblog: http://erablog.net/blogs/george_v_reilly/
          Your message has been successfully submitted and would be delivered to recipients shortly.