Re: [請益] UTF-8的問題~~
※ 引述《b8888 (b8888)》之銘言:
: 各位大大好~~~
: 小弟用fedora9架了一個站 Apache + PHP
: 我的編輯器用的是 Notepad++
: 在PC端以 Notepad++ 看檔案都很正常
: 但是上傳到主機上以vi 看卻都是亂碼~~
: 在pc端我以筆記本(M$附的)看-->正常
: 以UltraEdit-32(Ver 11.00) 看-->亂碼
: 請問這是主機的問題嗎?????
: --> 是否該將主機設成支援UTF-8
主機要設成支援UTF-8
: 謝謝您的回答
接著,另建一個 .vimrc_utf8 的純文字檔
放到你的家目錄
以下是內容
if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
set fileencodings=utf-8,latin1
endif
set nocompatible " Use Vim defaults (much better!)
set bs=2 " allow backspacing over everything in insert mode
"set ai " always set autoindenting on
"set backup " keep a backup file
set viminfo='20,\"50 " read/write a .viminfo file, don't store more
" than 50 lines of registers
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
" Only do this part when compiled with support for autocommands
if has("autocmd")
" In text files, always limit the width of text to 78 characters
autocmd BufRead *.txt set tw=78
" When editing a file, always jump to the last cursor position
autocmd BufReadPost *
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal g'\"" |
\ endif
endif
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif
if &term=="xterm"
set t_Co=8
set t_Sb=^[4%dm
set t_Sf=^[3%dm
endif
syntax on
set tabstop=4
set encoding=utf-8
set backspace=indent,eol,start
存檔後,再建一個 viu.sh ,一樣放到你家目錄
以下是內容
#!/bin/bash
vim -u ~/.vimrc_utf-8 $1
以後要編輯檔案時,就下這個指令
~/viu.sh 檔案名稱
參考資料:Tsung's Blog http://blog.longwin.com.tw/archives/000114.html
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.130.203.236
→
08/01 14:57, , 1F
08/01 14:57, 1F
討論串 (同標題文章)
PHP 近期熱門文章
PTT數位生活區 即時熱門文章