LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   vi encoding (http://www.linuxquestions.org/questions/programming-9/vi-encoding-408242/)

russiantux 01-26-2006 11:11 AM

vi encoding
 
i write files (c,h,cpp) at vi. i need save them at UTF-8 encoding. how to do it ?

TheLinuxDuck 01-26-2006 11:59 AM

Has your version of vim been compiled with support for this?
You can check by running:
Quote:

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:
Quote:

:language
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:
Quote:

:set encoding
You can set it to UTF-8 by:
Quote:

: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:
http://www.vim.org/htmldoc/mbyte.html

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


All times are GMT -5. The time now is 03:25 PM.