ANSI<>UNICODE and reverse

11 views
Skip to first unread message

Paolo Baruffa

unread,
Nov 5, 2009, 6:56:49 AM11/5/09
to vim_mu...@googlegroups.com
Hi all!
I need to perform ANSI/UNICODE commands in my GVIM.
I read many docs on the web about and I did set these:

"------------------------------------------
" .vimrc includes
"----------------------
:set ffs=dos,unix,mac " autosense Dos,Unix,Mac
:set fileencodings=ucs-bom,utf-8,latin1 " autosense coding
" (no fileencoding is set in .vimrc)

"------------------------------------------
" my menu includes
"----------------------

:set fileencoding=latin1<CR><Esc>:set ff=dos<CR>:w!<CR> " ANSI Dos
:set fileencoding=utf-8<CR>:w!<CR><Esc> " UNICODE

"-------------------------------------------

but they don't work correctly (I check the files with an
other editor)...

1) I open an ANSI file with GVim, I ask ":set fileencoding"
and the file appears as "utf-8"

2) conversion between ANSI <> UNICODE and then reverse likes
right ("converted" in bottom status line), but refreshing
the file on the other editor I see the same coding...

Does anybody can help, pls?

winterTTr

unread,
Nov 5, 2009, 7:54:24 PM11/5/09
to vim_mu...@googlegroups.com
On Thu, Nov 5, 2009 at 7:56 PM, Paolo Baruffa <win...@people.it> wrote:

Hi all!
I need to perform ANSI/UNICODE commands in my GVIM.
I read many docs on the web about and I did set these:

"------------------------------------------
"       .vimrc  includes
"----------------------
:set ffs=dos,unix,mac   "       autosense Dos,Unix,Mac
:set fileencodings=ucs-bom,utf-8,latin1 "       autosense coding
" (no fileencoding is set in .vimrc)

"------------------------------------------
"       my menu includes
"----------------------

:set fileencoding=latin1<CR><Esc>:set ff=dos<CR>:w!<CR> " ANSI Dos
:set fileencoding=utf-8<CR>:w!<CR><Esc> " UNICODE

"-------------------------------------------

but they don't work correctly (I check the files with an
other editor)...

1) I open an ANSI file with GVim, I ask ":set fileencoding"
and the file appears as "utf-8"

What's the value for the option "encoding" ?
if the "encoding" is set to utf-8 when you don't set "fenc" , the file 
will open with the same encoding as what you set to enc , which should 
become 'utf8'
 

2) conversion between ANSI <> UNICODE and then reverse likes
right ("converted" in bottom status line), but refreshing
the file on the other editor I see the same coding...

What do you mean for the "The same coding "?
The coding is always ANSI or UNICODE?

And before this , there is something should be mentioned.
UTF-8 is a variable-length character encoding for UNICODE , and 
if you original file is ansi encoding ,  when it is convert to utf8 ( without BOM),
the file should be same ( seems like no convert ). Because utf8 uses the single
octet encoding only for the 128 US-ASCII characters  which is the same as
when it is encoding with ansi.

John Beckett

unread,
Nov 5, 2009, 9:22:46 PM11/5/09
to vim_mu...@googlegroups.com
Paolo wrote:
> I need to perform ANSI/UNICODE commands in my GVIM.

See discussion in vim_use
http://groups.google.com/group/vim_use/browse_thread/thread/cc7e9076fa7d277d

John

Reply all
Reply to author
Forward
0 new messages