vim and unicode

Max Brown max.e.brown at gmail.com
Wed Sep 16 07:17:06 PDT 2009


Hi,

I am having some problems with vim and unicode files.

If I create a file test.txt with some random text in it, then open it
in vim, :set encoding=unicode, and save, then strange things happen:

$ cat test.txt
123
123
max:~ max$ file test.txt
test.txt: ASCII text
max:~ max$ vim test.txt
max:~ max$ file test.txt
test.txt: binary Computer Graphics Metafile

If I now open the text file in vim, there are lots of strange
characters interspersed. The file looks ok in Textedit.

Is this expected behaviour?

Thanks.

Max

=8<=================================

My vim version:

max:~ max$ port installed vim
The following ports are currently installed:
  vim @7.2.245_0 (active)
max:~ max$ vim --version
VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Aug 20 2009 20:39:57)
MacOS X (unix) version
Included patches: 1-245
Compiled by max at somewhere
Normal version without GUI.  Features included (+) or not (-):
-arabic +autocmd -balloon_eval -browse +builtin_terms +byte_offset +cindent
-clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
+cryptv -cscope +cursorshape +dialog_con +diff +digraphs -dnd -ebcdic
-emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path +find_in_path
+float +folding -footer +fork() -gettext -hangul_input +iconv +insert_expand
+jumplist -keymap -langmap +libcall +linebreak +lispindent +listcmds +localmap
+menu +mksession +modify_fname +mouse -mouseshape -mouse_dec -mouse_gpm
-mouse_jsbterm -mouse_netterm -mouse_sysmouse +mouse_xterm +multi_byte
+multi_lang -mzscheme -netbeans_intg -osfiletype +path_extra -perl +postscript
+printer -profile -python +quickfix +reltime -rightleft -ruby +scrollbind
-signs +smartindent -sniff +statusline -sun_workshop +syntax +tag_binary
+tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title
 -toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo
+vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp
 -xterm_clipboard -xterm_save
   system vimrc file: "/opt/local/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/opt/local/share/vim"
Compilation: /usr/bin/gcc-4.0 -c -I. -Iproto -DHAVE_CONFIG_H
-I/opt/local/include -DMACOS_X_UNIX -no-cpp-precomp
-I/Developer/Headers/FlatCarbon  -O -D_FORTIFY_SOURCE=1
Linking: /usr/bin/gcc-4.0   -L/opt/local/lib -L/usr/local/lib -o vim
    -lm  -lncurses -liconv -framework Carbon


More information about the macports-users mailing list