GVim doesn't display Euro symbol ?

772 views
Skip to first unread message

Lucas Sanner

unread,
Jul 25, 2012, 6:53:24 AM7/25/12
to vim_use
Hi,

I just can't display Euro symbol (and some others) typing Alt Gr + e
into GVim under Windows 7, it only displays a tiny square.

In _gvimrc my setting looks like this:

set fileencodings=ucs-bom,utf-8,latin1

I'm a little bit confused between utf-8 and unicode but so
far I've never had encoding pb until now that I need to use
currencies symbol.

Can someone helps me ?

Thanks

Ben Fritz

unread,
Jul 25, 2012, 10:59:58 AM7/25/12
to vim...@googlegroups.com
On Wednesday, July 25, 2012 5:53:24 AM UTC-5, Lucas Sanner wrote:
> Hi,
>
> I just can't display Euro symbol (and some others) typing Alt Gr + e
> into GVim under Windows 7, it only displays a tiny square.
>
> In _gvimrc my setting looks like this:
>
> set fileencodings=ucs-bom,utf-8,latin1
>
> I'm a little bit confused between utf-8 and unicode but so
> far I've never had encoding pb until now that I need to use
> currencies symbol.
>
> Can someone helps me ?
>
> Thanks

First, are you using a font which actually has a glyph for the Euro symbol? Check the current font actually in use with :echo getfontname(), then check with charmap or a similar utility to be sure it has the glyph you want, or select a different font. See http://vim.wikia.com/wiki/Setting_the_font_in_the_GUI

Second, is your 'encoding' option set to a unicode encoding? Vim cannot internally represent all symbols otherwise. See http://vim.wikia.com/wiki/Working_with_Unicode

Finally, Vim offers a "digraph" feature to enter special characters. Try using CTRL-K followed by E and then u (<C-K>Eu) in insert mode to enter a Euro symbol.

Lucas Sanner

unread,
Jul 26, 2012, 5:47:19 AM7/26/12
to vim_use
Thanks for your response.
Indeed, pb came from the font selected. I used fyxedsys font which
didn't recognize
Euro symbol and such.
So I chosen "Courrier New" font and it works now.
But there's a new issue which is GVim intern messages seems no longer
display
accentued characters. For example GVim displays "<e9>" instead of "é".
How can I fix this ?

Thanks

Ben Fritz

unread,
Jul 26, 2012, 11:55:20 AM7/26/12
to vim...@googlegroups.com
On Thursday, July 26, 2012 4:47:19 AM UTC-5, Lucas Sanner wrote:
> Thanks for your response.
> Indeed, pb came from the font selected. I used fyxedsys font which
> didn&#39;t recognize
> Euro symbol and such.
> So I chosen &quot;Courrier New&quot; font and it works now.
> But there&#39;s a new issue which is GVim intern messages seems no longer
> display
> accentued characters. For example GVim displays &quot;&lt;e9&gt;&quot; instead of &quot;é&quot;.
> How can I fix this ?
>
> Thanks

What is your 'encoding' option set to? This controls Vim's internal representation of character data.

Lucas Sanner

unread,
Jul 26, 2012, 1:13:31 PM7/26/12
to vim_use
> What is your 'encoding' option set to? This controls Vim's internal representation of character data.

In _gvimrc the encoding is set as follows:

set encoding=utf-8

Is it the correct encoding ?

Ben Fritz

unread,
Jul 26, 2012, 1:39:38 PM7/26/12
to vim...@googlegroups.com
On Thursday, July 26, 2012 12:13:31 PM UTC-5, Lucas Sanner wrote:
> &gt; What is your &#39;encoding&#39; option set to? This controls Vim&#39;s internal representation of character data.
>
> In _gvimrc the encoding is set as follows:
>
> set encoding=utf-8
>
> Is it the correct encoding ?

It's the correct encoding, but it's probably too late in the scripts read at init.

It should go in the _vimrc, before pretty much anything else. Otherwise Vim will keep the same bytes in memory for mappings, registers, etc. made before the encoding change, but now interpret them (incorrectly) as if they were in the new encoding.

For example, here's the top few lines of my .vimrc:

" enable advanced Vim features
set nocompatible

if has('multi_byte')
if &termencoding==""
let &termencoding=&encoding
endif
set encoding=utf-8

Lucas Sanner

unread,
Jul 26, 2012, 1:58:06 PM7/26/12
to vim_use
I put these 2 lines into my _vimrc:

set fileencodings=ucs-bom,utf-8,latin1
set encoding=utf-8

but the issue still occurs.

Any idea ?

Ben Fritz

unread,
Jul 26, 2012, 2:59:43 PM7/26/12
to vim...@googlegroups.com
No idea. Can you reproduce your issue with gvim -N -u NONE -i NONE? If not, can you come up with a set of specific commands from that point which will reproduce the issue?

Lucas Sanner

unread,
Jul 27, 2012, 3:41:24 AM7/27/12
to vim_use
I use GVim in french language, so there a lot of accentued characters
in
the command messages.
For example if I write into a file ":w", I get

181L, 7804C <e9>crit(s)

instead of

181L, 7804C écrit(s)

Maybe a Vim language file with wrong encoding ?

Dominique Pellé

unread,
Jul 27, 2012, 4:59:23 AM7/27/12
to vim...@googlegroups.com
Your locale setting is probably wrong.

Which OS do you use?
I remember seeing that Win XP did not use Unicode by default but
uses Windows code page 1252 (sigh).

I think this can be fixed by setting the LANG environment variable.
In Control Panel -> System -> Advanced -> Environment Variables,
add the environment variable LANG setting it to fr_FR.UTF-8
Then restart GVim.

Regards
-- Dominique

Lucas Sanner

unread,
Jul 27, 2012, 5:29:19 AM7/27/12
to vim_use
> Which OS do you use?
Windows 7

I tried to set a new language environnement variable but pb still
occurs.
I remember having same issue some years ago and I fixed up using
fyxedsys font, but
now that I've changed GVim font, the issue comes back again.
I really don't know where this pb comes from.

Dominique Pellé

unread,
Jul 27, 2012, 6:06:29 AM7/27/12
to vim...@googlegroups.com
What's the output of the following commands?

:language

:verbose set enc?

Regards
-- Dominique

Lucas Sanner

unread,
Jul 27, 2012, 6:29:26 AM7/27/12
to vim_use

> :language
"LC_COLLATE=French_France.1252;LC_TYPE=C;LC_MONETARY=French_France.
1252;LC_NUMERIC=C;LC_TIME=French_France.1252"

> :verbose set enc?
encoding=utf-8

Dominique Pellé

unread,
Jul 31, 2012, 12:44:56 AM7/31/12
to vim...@googlegroups.com
Lucas Sanner wrote:

>> :language
> "LC_COLLATE=French_France.1252;LC_TYPE=C;LC_MONETARY=French_France.
> 1252;LC_NUMERIC=C;LC_TIME=French_France.1252"

The 1252 there indicates that your locale is not using
Unicode but it's using the Windows code page 1252:

http://en.wikipedia.org/wiki/Windows-1252

I don't know why Gvim on windows uses Windows code page
by default and not Unicode. It's annoying. Is it Windows fault or
Vim fault? I'm also surprised that I don't see LC_MESSAGES=...

I remember that I had the same problem on Windows XP,
and that for me setting the LANG env variable to fr_FR.UTF-8
worked. I'm not sure why it's not working for you and I don't have
a Windows machine to try again.

I found this http://superuser.com/questions/207264/gvim-utf-8-in-windows
which describe the same problem. The solution seems to
be to install libiconv (iconv.dll) as described in above link.

See also:
http://stackoverflow.com/questions/9591813/what-do-vims-iconv-dll-and-libintl-dll-do

>> :verbose set enc?
> encoding=utf-8

That's good at least.

By the way, you never indicated what version of Vim you're using.
(output of :version)

-- Dominique

Lucas Sanner

unread,
Jul 31, 2012, 3:28:25 AM7/31/12
to vim_use
> By the way, you never indicated what version of Vim you're using.

I used the 7.3 GVim version

The subject topic you mentioned is relevant for my case

http://superuser.com/questions/207264/gvim-utf-8-in-windows

I installed the 2 dlls as described in the topic and it does
work now. Accentued characters are correctly displayed.

> I don't know why Gvim on windows uses Windows code page
> by default and not Unicode. It's annoying. Is it Windows fault or
> Vim fault? I'm also surprised that I don't see LC_MESSAGES=...

Indeed, I dont know either why GVim doesn't use Unicode.
Odd, but since it works with the 2 dlls everything it's ok.

Thanks a lot for your help.

Tony Mechelynck

unread,
Jul 31, 2012, 4:42:25 AM7/31/12
to vim...@googlegroups.com, Dominique Pellé
Vim gets its "language" settings from the OS locale at startup. On
Linux, this usually means one of

en_US.UTF-8
fr_FR.UTF-8
de_AT.UTF-8
etc., so Vim uses UTF-8 by default there. But on Windows, typical
locales are things like

French_Belgium.1252
etc., and therefore Vim doesn't use UTF-8 by default on Windows. See
http://vim.wikia.com/wiki/Working_with_Unicode
about how to tell Vim near the top of your vimrc that you want it to use
UTF-8 rather than the OS locale. Similarly, if you want messages and
menus in English rather than in the OS locale language, you would use

if has('unix')
lang mess C
else
lang mess en
endif

near the top of your vimrc (Windows knows nothing about the C locale,
which is recognized on all POSIX installations).


Best regards,
Tony.
--
Go 'way! You're bothering me!

Reply all
Reply to author
Forward
0 new messages