Thursday, November 14, 2013

Re: Encoding Issues on Windows

On 14/11/13 18:50, Alexander Shukaev wrote:
> My encoding settings look as follows:
>
> if has('multi_byte')
> if empty(&termencoding)
> let &termencoding = &encoding
> endif
> let &encoding = 'utf-8'
> let &fileencoding = 'utf-8'
> endif
>
> I have no problems running under GVim: can type any characters, and my patched Consolas for Powerline works just fine. The problems start when I try to run Vim in terminal mode. I use ConEmu (https://code.google.com/p/conemu-maximus5/). a feature-rich terminal emulator for Windows. It claims to officially support Unicode out of the box. Furthermore, reading through `:h termencoding`, I see that Win32 uses Unicode by default to pass symbols. Now, the problem is that I don't understand why when I type anything non-ANSI in terminal Vim, I see `?` symbols? Furthermore, Airline does not display fancy symbols from patched Consolas as well. How to configure true Unicode for terminal Vim on Win32?
>
> Thanks, regards.
>

For questions internal to Vim, see
http://vim.wikia.org/wiki/Working_with_Unicode

In addition to what is said there, in order to _display_ correctly what
you type into Console Vim, you need a terminal font with the necessary
glyphs for whatever characters you're typing. Most fonts only have
glyphs for a comparatively small parts of all the characters to which
the Unicode Consortium has assigned a codepoint, almost always ASCII,
and often in addition the characters frequently used in a given country:
for instance a font targeted at China will probably have, in addition to
ASCII, all Chinese characters (sometimes only either the Traditional
ones used at Hong Kong and Taiwan _or_ the Simplified ones in use in
Mainland China, and sometimes not the rarest ones); it may have also
Japanese kana and "national" kanji, and Korean Hangeul; it may or may
not have Thai, or Russian and Mongol Cyrillic; it probably won't have
the glyphs for Tamazight, Cherokee or Deseret. How to set the terminal
font varies from terminal to terminal (on Linux there are a bevy of
different terminal emulators, there are several also on the Mac, while
on Windows there is only one AFAIK, and I can't help you there because
I'm on Linux). Any character that has no glyph in your font will be
shown by means of some "fallback glyph", possibilities frequently seen
are an empty box or a reverse-video question mark. Even if the terminal
cannot display a character, Vim will represent it correctly in memory
and on disk — provided that 'encoding' is UTF-8 or the 'encoding' in use
is compatible with the file's 'fileencoding' _and_, for files being
modified rather than created, the file's encoding has been correctly
set, either automatically via 'fileencodings' [plural], or manually by
using the ++enc modifier in the :edit, :view, or similar command used to
read the file. You can check how a character is represented in memory by
putting the cursor on it then doing ga — this will show its
representation in decimal, hex and octal, in addition to the glyph used,
which, of course, won't be the "right" glyph if the font in use hasn't
got it.


Best regards,
Tony.
--
There was a young man of Khartoum
Who lured a poor girl to her doom.
He not only fucked her,
But buggered and sucked her--
And left her to pay for the room.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: