LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 12-06-2017, 02:11 AM   #1
mcmxciv
LQ Newbie
 
Registered: Nov 2017
Posts: 17

Rep: Reputation: Disabled
could Vim save file as Unicode format?


On windows platform,file could be saved as Unicode encoding.For example,typing <Ctrl-K> Co yields a extended ascii character 0xA9.
If saved as unicode encoding,its binary is 'FF FE C8 00',but if saved as UTF-8,its binary encoding is '88c3'.
Could Vim save file as Unicode encoding too?

Last edited by mcmxciv; 12-06-2017 at 02:15 AM.
 
Old 12-06-2017, 04:16 AM   #2
aragorn2101
Member
 
Registered: Dec 2012
Location: Mauritius
Distribution: Slackware
Posts: 527

Rep: Reputation: 246Reputation: 246Reputation: 246
Yes it can.

Check these out:
http://vim.wikia.com/wiki/Working_with_Unicode
http://vim.wikia.com/wiki/Reloading_...erent_encoding

On my system, it is very easy since I set the locale to UTF-8. My LANG environment variable is set this way:
Code:
echo $LANG
en_GB.utf8
So I get UTF-8 support in vim automatically.
 
1 members found this post helpful.
Old 12-06-2017, 09:10 AM   #3
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,482

Rep: Reputation: 997Reputation: 997Reputation: 997Reputation: 997Reputation: 997Reputation: 997Reputation: 997Reputation: 997
Unless you have your system set up with some old locale, vim will automatically save in unicode format.
 
Old 12-06-2017, 08:37 PM   #4
mcmxciv
LQ Newbie
 
Registered: Nov 2017
Posts: 17

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by AwesomeMachine View Post
Unless you have your system set up with some old locale, vim will automatically save in unicode format.
If it is saved in unicode encoding,it should be '00 c8'.But actual its binary encoding is :c3 88,which is encoding in UTF-8 format.

[root@ tmp]# cat f

[root@ tmp]# od -t x f
0000000 000a88c3
0000003
 
  


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
VIM: Displaying UTF-8 Unicode text into xterm Xeratul Linux - General 1 04-07-2017 09:36 AM
LXer: HowTo: Save A File In Vim / Vi Without Root Permission LXer Syndicated Linux News 0 04-11-2010 08:10 AM
LXer: Turning on Unicode Support in Vim LXer Syndicated Linux News 0 06-22-2009 08:12 PM
How to save file in UTF-8 format? Hondro Programming 1 11-20-2006 01:34 PM
Vim Save Hooks dlublink Linux - Software 2 09-24-2006 09:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:43 PM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration