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. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
09-27-2006, 04:31 AM
|
#1
|
Member
Registered: Oct 2005
Location: China
Distribution: ArchLinux
Posts: 103
Rep:
|
How to edit UTF-8 file in VIM ?
When I use Windows & IE, I downloaded lots of html file, and them be encoded by UTF-8.
Now, I want to edit them in VIM.
But, all the Unicode characters are wrong.
I use "set encoding=utf-8", but it doesn't work well. That is, all the
wrong characters are changed, but they are wrong, too.
How to solve this problem?
addtion:
I use Slackware+rxvt+vim
|
|
|
09-27-2006, 09:58 AM
|
#2
|
Senior Member
Registered: Jul 2004
Location: Phoenix, Arizona
Distribution: Gentoo, LFS, Debian,Ubuntu
Posts: 1,537
Rep:
|
When I save a source file it saves as ANSI not UTF-8 unless your changeing the encoding or something ?
|
|
|
09-27-2006, 10:39 AM
|
#3
|
LQ Newbie
Registered: Nov 2005
Distribution: Arch
Posts: 27
Rep:
|
:e ++enc=utf-8 <your-file-name>
I use utf-8 locale and don't have any problems with utf-8.
|
|
|
09-27-2006, 12:18 PM
|
#4
|
Senior Member
Registered: Jul 2005
Distribution: Slackware
Posts: 2,012
Rep:
|
Slackware doesn't build UTF-8 support into vim. You can get a version with utf-8 support from the Japanese on Slack project, build it yourself, or perhaps convert it to EUC and back again.
|
|
|
09-27-2006, 07:55 PM
|
#5
|
Member
Registered: Oct 2005
Location: China
Distribution: ArchLinux
Posts: 103
Original Poster
Rep:
|
Quote:
Originally Posted by silent_cutthroat
:e ++enc=utf-8 <your-file-name>
I use utf-8 locale and don't have any problems with utf-8.
|
How to use utf-8 locale ?
|
|
|
09-27-2006, 07:59 PM
|
#6
|
Member
Registered: Oct 2005
Location: China
Distribution: ArchLinux
Posts: 103
Original Poster
Rep:
|
Quote:
Originally Posted by tuxdev
Slackware doesn't build UTF-8 support into vim. You can get a version with utf-8 support from the Japanese on Slack project, build it yourself, or perhaps convert it to EUC and back again.
|
I downloaded the vim7.0's source file, but I can't find the utf-8 support in the "./configure --help".
and this is my vim's version
Code:
VIM - Vi IMproved 6.3 (2004 June 7, compiled Sep 10 2005 15:25:19)
Included patches: 1-86
Compiled by root@midas
Big version with GTK2 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 +dialog_con_gui +diff +digraphs +dnd -ebcdic +emacs_tags +eval
+ex_extra +extra_search +farsi +file_in_path +find_in_path +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_xterm +multi_byte +multi_lang +netbeans_intg -osfiletype
+path_extra -perl +postscript +printer -python +quickfix +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_interact +xterm_clipboard -xterm_save
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "$VIM/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
system menu file: "$VIMRUNTIME/menu.vim"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -DXTHREADS -D_REENTRANT -DXUSE_MTSAFE_API -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/X11R6/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/freetype2/config -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -O2 -I/usr/X11R6/include
Linking: gcc -L/usr/X11R6/lib -L/usr/local/lib -o vim -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangoxft-1.0 -lpangox-1.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lXt -lncurses -lgpm
It has a "+multi_byte", and is it really not build utf-8 support?
Last edited by naihe2010; 09-27-2006 at 08:01 PM.
|
|
|
09-28-2006, 01:36 AM
|
#7
|
LQ Newbie
Registered: Nov 2005
Distribution: Arch
Posts: 27
Rep:
|
The vim online docs - http://www.vim.org/htmldoc/mbyte.html
Quote:
Originally Posted by naihe2010
How to use utf-8 locale ?
|
You set the LANG environment variable to something like en_US.utf-8, to see the supported locales - 'locale -a'. LANG is set in some of the scripts run on startup, to change your locale for all the users you shoud set LANG from there, but I can't remeber exactly where. Look at /etc/profile.d/ and /etc/rc.d/.
Also see the locale man page.
|
|
|
All times are GMT -5. The time now is 08:44 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|