LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 04-11-2012, 12:32 AM   #1
WojtekO
Member
 
Registered: May 2006
Distribution: CentOS 5
Posts: 47

Rep: Reputation: 15
How to make VIM display french letters?


I have some files that I'd like to be able to edit in vim, unfortunately they have some french characters in the content with accents, and vim destroys them.

I get
Quote:
une entreprise spécialisée
instead of
Quote:
une entreprise spcialise
If I do a cat on that file, it displays the french characters OK.

I tried doing in vim:
Quote:
:set encoding=utf-8
But it had no effect.

How could I solve this issue?

Thank You
 
Old 04-11-2012, 12:52 AM   #2
EricTRA
Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290
Hi,

When in vim, what's the output of the following:
Code:
:verbose set enc? tenc?
and
Code:
:lang
Kind regards,

Eric
 
Old 04-11-2012, 12:53 AM   #3
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,627

Rep: Reputation: Disabled
See if this link helps setting up the locales in vim.

http://stackoverflow.com/questions/1...anguage-in-vim
 
Old 04-11-2012, 11:18 AM   #4
WojtekO
Member
 
Registered: May 2006
Distribution: CentOS 5
Posts: 47

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by EricTRA View Post
Hi,

When in vim, what's the output of the following:
Code:
:verbose set enc? tenc?
and
Code:
:lang
Kind regards,

Eric
The first one returns this:
Code:
encoding=utf-8
termencoding=
And the second this:
Code:
Current language: "en_US.UTF-8"
I tried doing:
Code:
:set termencoding=utf-8
Which then displayed this:
Code:
:verbose set enc? tenc?
  encoding=utf-8
  termencoding=utf-8
But the opened document still had the broken characters.
Re-opening it, cleared the termencoding value back to blank.



Quote:
Originally Posted by linuxlover.chaitanya View Post
See if this link helps setting up the locales in vim.

http://stackoverflow.com/questions/1...anguage-in-vim
I looked at this and it seems it's for changing vim's language for menus and messages.
I want to keep mine in english, but be able to display french characters.
Thanks
 
Old 04-11-2012, 01:42 PM   #5
EricTRA
Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290
Hi,

Thanks for the feedback. And what's the output of
Code:
locale
Kind regards,

Eric
 
Old 04-11-2012, 03:49 PM   #6
WojtekO
Member
 
Registered: May 2006
Distribution: CentOS 5
Posts: 47

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by EricTRA View Post
Hi,

Thanks for the feedback. And what's the output of
Code:
locale
Kind regards,

Eric
Here is the output:
Code:
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
Thank You
 
Old 04-11-2012, 09:40 PM   #7
EricTRA
Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290
Hi,

Very strange, I have almost the same settings and output except for the :lang in vim and I can open a document with French text without loosing any accented characters. All this using all en_US.UTF-8 with a Spanish keyboard. Can you run the file command on the file and post the output, to check what encoding the file is in?
Code:
file <yourfilewithaccents>
--EDIT--

Just found another thing that might be useful. When you have the file with the French text open in vim type the following and post the output:
Code:
:set fileencoding?
to find out which file encoding vim detects on the file.

Kind regards,

Eric

Last edited by EricTRA; 04-11-2012 at 09:50 PM.
 
Old 04-12-2012, 02:53 PM   #8
WojtekO
Member
 
Registered: May 2006
Distribution: CentOS 5
Posts: 47

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by EricTRA View Post
Hi,

Very strange, I have almost the same settings and output except for the :lang in vim and I can open a document with French text without loosing any accented characters. All this using all en_US.UTF-8 with a Spanish keyboard. Can you run the file command on the file and post the output, to check what encoding the file is in?
Code:
file <yourfilewithaccents>
--EDIT--

Just found another thing that might be useful. When you have the file with the French text open in vim type the following and post the output:
Code:
:set fileencoding?
to find out which file encoding vim detects on the file.

Kind regards,

Eric
the file command returns:
Code:
ISO-8859 text, with no line terminators
:set fileencoding? returns:
Code:
fileencoding=latin1

Thanks for pointing me to the right direction!

Code:
vim ~/.vimrc
set encoding=iso-8859-1
made it work, I can now properly see the accented characters.

Thanks again,
 
Old 04-13-2012, 12:50 AM   #9
EricTRA
Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290
Hi,

Nice to hear you've got it working. Thanks for marking the thread as solved.

Kind regards,

Eric
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
'l' letters are constantly highlighted in VIM?! MheAd Linux - Newbie 11 04-04-2012 11:41 AM
How do i make a script that checks that my input is letters or numbers ? ministeren Programming 13 05-20-2010 09:36 AM
How to input french or german characters under vim?? zhaoyoubing Linux - General 4 06-16-2007 07:12 AM
how to make open office auto correct to french languages tony safari Linux - Desktop 2 03-11-2007 10:49 AM
xdvi does not display french letters fatra2 Linux - Software 1 07-06-2004 08:44 AM


All times are GMT -5. The time now is 05:40 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration