On 6/13/06, A.J.Mechelynck wrote:
Mojca Miklavec wrote:

Courier_New has a larger variety of glyphs than most other fixed-width
encodings. If Lucida_Console hasn't got the glyphs you need, I recommend
Courier_New.

No, Lucide_Console is OK (and Courier_New as well), but on
high-resolution they are a bit too thin for my eyes. ... (but that's
not the main point of my question anyway)

>   set encoding=utf-8 termencoding=cp1250

This tells gvim to represent the data internally using UTF-8 but to go
on interpreting the data sent by your keyboard according to cp1250 which
is what Windows sends.

>   set fileencodings=ucs-bom,utf-8,cp1250

This defines the heuristics used by gvim to detect a file's charset when
opening it for editing. They are used from left to right:

    - "ucs-bom": if the file starts with a BOM, the Unicode encoding
defined by the BOM is used. (The BOM is a prefix of two to four bytes,
different for all Unicode encodings, and the BOM for each encoding is
illegal in all others.) If there is no BOM, then:
    - "utf-8": if the data in the file is valid for UTF-8, then Vim does
the equivalent of "setlocal fileencoding=utf-8". If it is no valid
UTF-8, then:
    - "cp1250": This is an 8-bit encoding, it cannot return an "invalid"
signal. If none of the above is recognised, then the file is read
according to the Windows-1250 charset (Windows proprietary charset for
Central Europe).

Thanks!

> OK, I only left
>   set fileencodings=ucs-bom,utf-8,cp1250
> in my _vimrc and the menues seem to be OK now.

With these settings, you will be able to edit cp1250 files; but UTF-8
files containing codepoints not pesent in cp1250 will appear garbled
(Unicode caters for more than 10 million characters, cp1250 has only 256).

UTF-8 files are opened properly (which is perfect). It's only for the
new files that I have to set encoding manually. That would be pretty
cumbersome, since I try to switch to UTF-8 completely anyway and I
would most probably keep forgetting to set the proper encoding each
time.

Since your Windows encoding is Windows-1250, I believe it would be more
"prudent" to write your menufile in cp1250 (and, I suppose, include
cp1250 in its name where there was utf-8).

I prepared all three variants (cp1250, utf-8 and latin2), but it
really doesn't seem to matter to gvim which one I use. If one works,
all of them do and if one doesn't, all three fail.

See ":help ++opt" about how to set the file's charset manually when
reading or writing.

Thank you. That one should be part of the "save as" and "open" menu as
well. (I try to learn new commands every now and then or when I need
to do some repetitive task, but being able to use some standard
Windows shortcuts or menu really simplifies everything for
non-experts.) It would be great if the user could set the encoding
"visually". No matter how strange it may sound - I often use Mozilla
to check the encoding of arbitrary files. It might be due to the lack
of my skills with vim (and due to too many encodings everywhere: one
for keyboard, one for file, one for font, one for menu, one for
mapping, one for cummunication with operating system ...).
(Working with encodings in Mozilla is much more intuitive, but I may
not compare it with Vim, which is much more powerful if you know how
to use it.)

IMHO you may change 'encoding' after the menus have been set up. For
instance:

    source $VIMRUNTIME/vimrc_example.vim
    if &termencoding == ""
       set &termencoding = &encoding
    endif
    set encoding=utf-8 fileencodings=ucs-bom,utf-8,cp1250
    " I believe the following will set 'fileencoding' to cp1250 by default
    " for newly-created files, and set a BOM at the start of
newly-created Unicode files
    setglobal fileencoding=cp1250 bomb

The example above didn't work. I was able to say
    if &termencoding == ""
       set termencoding = encoding
    endif
(without the '&' sign) in which case I get a message window each time
when I start gvim, saying that "encoding=cp1250".

But
   set encoding=utf-8
after that influences the menu and the menu is wrong again, no matter
where in _vimrc I set it.

Also, the following recipe described under :help menutrans doesn't work:
        :source $VIMRUNTIME/delmenu.vim
        :source c:\soft\vim\vim70\lang\menu_sl_si.cp1250.vim
        :source $VIMRUNTIME/menu.vim

I get the English menu instead, even if I additionally set
        :language messages sl_SI.cp1250
which you suggested

(Menus are set up, in your Windows default language and encoding which
are SL.cp1250, by the vimrc_example.

Do you want to say that vimrc_example sets anything relevat? Because I
can't find any font/language/encoding-related commands there.

Once the latter has been sourced,
changing the 'encoding' won't change the menus until or unless you
remove and re-add all menus.)

Where and when exactly are the menus set up/loaded? Because
vimrc_example doesn't set/load enything.

If the above gives you English menus, add

    language messages sl_SI.cp1250

only "sl" alone is allowed, but that doesn't change anything.

(or whatever) *before* the line for the vimrc_example.

Thanks for all the hints ... I hope that I will be able to find a way
out of this mess with your help. I really appreciate it! (It's just a
bit confusing.)

Mojca

Reply via email to