Visit the LQ Articles and Editorials section
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 01-26-2006, 11:11 AM   #1
LQ Newbie
Registered: Dec 2005
Posts: 2

Rep: Reputation: 0
vi encoding

i write files (c,h,cpp) at vi. i need save them at UTF-8 encoding. how to do it ?
Old 01-26-2006, 11:59 AM   #2
Registered: Sep 2002
Location: Tulsa, OK
Distribution: Slack, baby!
Posts: 349

Rep: Reputation: 33
Has your version of vim been compiled with support for this?
You can check by running:
vim --version | grep multi_byte
If there is a '-' in front, then your version of vim was not compiled with it, and you'll have to recompile vim with what they call "big" features (you'll have to read the compilation/installation docs for more information).

If there is a '+' in front, then you're one step closer. (=

Also, doublecheck that your systems locale is set correctly. I would imagine that it is, but checking is good. (See if the environment var LANG is set to your locale).

Then, inside of vim, check to see that the 'language' option is set correctly (this will only work if your vim has multi_byte support compiled in). You can see it by loading vim and then issuing the command:
If it is not correct, you can set it as your environment locale setting.

Finally, you'll need to make sure that the 'encoding' option is set correctly (again, this will only work if multi_byte support has been compiled into vim). You can show it by loading vim and issueing the command:
:set encoding
You can set it to UTF-8 by:
:set encoding=utf-8
These options should all be settable in your ".vimrc" file, too.

All of this information and more can be found at:

вам желаю успех!


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
Encoding of ,, Anden008 Linux - General 2 11-17-2005 02:53 AM
Other than US encoding kornerr Linux - General 4 01-21-2005 09:42 AM
CD ripping and encoding? e1000 Linux - Software 5 05-22-2004 02:41 AM
encoding on a webpage spank Linux - Newbie 0 12-05-2003 04:49 PM
MP3 Encoding - Please Help biggsjm Linux - Software 9 10-06-2003 02:52 PM

All times are GMT -5. The time now is 04:58 PM.

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