日期:2014-05-16  浏览次数:20530 次

在线等 求助linux下的中文编码问题
使用ssh的rz工具把window下面的几个utf8编码的txt文件传入到linux下面
用vim的属性看txt的fileencoding为utf8
linux下c++程序使用文件流ofstream(filename, "ios::in")向txt文件里面写数据(含中文),然后再用sz文件将写好的txt文件传到window平台,发现文件变成ansi格式,在vim下面fileencoding变为cp936,请问怎么能够保持utf-8的格式不变呢

在线求助!!
请大神们帮忙看看

这是我的vim的配置文件内容

syntax on
set nu
hi Comment ctermfg=DarkCyan

set backspace=2


set mouse=a
set selection=exclusive
set selectmode=mouse,key

filetype on
filetype plugin on
filetype indent on

set fileencodings=utf-8
set encoding=utf-8
set ambiwidth=double

set hlsearch
set incsearch

set cindent
set tabstop=4
set autoindent
set showmatch
set matchtime=1

set wildmenu
setlocal noswapfile
set bufhidden=hide

------解决方案--------------------
程序中, 写入流时要自己做编码转换, 这样得到的文件才是 utf8 的,
用 iconv 转换