Caractères accentués

Résolu/Fermé
alrick Messages postés 5 Date d'inscription dimanche 20 avril 2008 Statut Membre Dernière intervention 31 octobre 2010 - 21 janv. 2010 à 10:50
mamiemando Messages postés 33079 Date d'inscription jeudi 12 mai 2005 Statut Modérateur Dernière intervention 23 avril 2024 - 8 févr. 2010 à 20:27
Bonjour,
Ecrivant quelques scripts en bash sous VI, je cherche à modifier le codage des caractères pour afficher les caractère accentués , notamment dans les commentaires.
J'ai essayé de mettre ces informationation dans le .bash_profile :

LC_CTYPE=ISO-8859-1
LC_ALL=fr_FR
LANG=fr
LESSCHARSET=latin1
export PATH PS1 LC_CTYPE LC_ALL LANG LESSCHARSET

Mais à l'ouverture de'une nouvelle session, et lancement de VI, l'écriture des caractères accentués est toujours incorrecte.

Les caractéristiques sont :
uname -a
Linux opblaa04 2.6.18-92.1.10.el5 #1 SMP Wed Jul 23 03:56:11 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux
cat redhat-release
Red Hat Enterprise Linux Server release 5.2 (Tikanga)

Merci pour votre aide
Richard
A voir également:

5 réponses

mamiemando Messages postés 33079 Date d'inscription jeudi 12 mai 2005 Statut Modérateur Dernière intervention 23 avril 2024 7 749
22 janv. 2010 à 02:00
Tu parles de l'écriture accentué à quel niveau ? Dans une console ? Parce que les coupables peuvent être multiples : la police utilisée, la locale etc...
0
alrick Messages postés 5 Date d'inscription dimanche 20 avril 2008 Statut Membre Dernière intervention 31 octobre 2010
31 janv. 2010 à 18:42
Bonjour,

En fait, je parle des caractères accdentué lorsque je lance VI et que dans les commentaires, je souhaite mettre des commentaire en français. Lorsque je tape des caractères accentués, j'obtiens à peu près n'importe quoi.

Cdlt
0
mamiemando Messages postés 33079 Date d'inscription jeudi 12 mai 2005 Statut Modérateur Dernière intervention 23 avril 2024 7 749
31 janv. 2010 à 23:46
Oui mais un vim lancé dans une console en mode texte ou dans un terminal graphique (konsole, gnome terminal...). Et est ce que le problème ne survient que dans vim ou également dans la console dans laquelle tu lances vim ?

Bonne chance
0
alrick Messages postés 5 Date d'inscription dimanche 20 avril 2008 Statut Membre Dernière intervention 31 octobre 2010
8 févr. 2010 à 13:39
En fait exclusivement lorsque je lance VIM (ou VI), d'où mon interrogation
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
mamiemando Messages postés 33079 Date d'inscription jeudi 12 mai 2005 Statut Modérateur Dernière intervention 23 avril 2024 7 749
8 févr. 2010 à 20:27
Bizarre. Honnêtement je ne sais pas trop d'où ça vient, donc voici mes variables d'environnements et mes fichiers de configuration vim. Au niveau des variables d'environnements, parmi celles que tu as cité je n'ai que LANG :

(mando@aldur) (~) $ env | grep LC
(mando@aldur) (~) $ env | grep -i fr
LANG=fr_FR.UTF-8
(mando@aldur) (~) $ echo $LESSCHARSET


Au niveau de /etc/vim/vimrc :

" All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just
" /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime
" you can find below.  If you wish to change any of those settings, you should
" do it in this file (/etc/vim/vimrc), since debian.vim will be overwritten
" everytime an upgrade of the vim packages is performed.  It is recommended to
" make changes after sourcing debian.vim since it alters the value of the
" 'compatible' option.

" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian.
runtime! debian.vim

" Uncomment the next line to make Vim more Vi-compatible
" NOTE: debian.vim sets 'nocompatible'.  Setting 'compatible' changes numerous
" options, so any other options should be set AFTER setting 'compatible'.
"set compatible

" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
"syntax on

" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
"set background=dark

" Uncomment the following to have Vim jump to the last position when
" reopening a file
"if has("autocmd")
"  au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
"endif

" Uncomment the following to have Vim load indentation rules and plugins
" according to the detected filetype.
"if has("autocmd")
"  filetype plugin indent on
"endif

" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
"set showcmd            " Show (partial) command in status line.
"set showmatch          " Show matching brackets.
"set ignorecase         " Do case insensitive matching
"set smartcase          " Do smart case matching
"set incsearch          " Incremental search
"set autowrite          " Automatically save before commands like :next and :make
"set hidden             " Hide buffers when they are abandoned
"set mouse=a            " Enable mouse usage (all modes)

" Source a global configuration file if available
if filereadable("/etc/vim/vimrc.local")
  source /etc/vim/vimrc.local
endif


Au niveau de /etc/vim/vim.tiny :

" Vim configuration file, in effect when invoked as "vi". The aim of this
" configuration file is to provide a Vim environment as compatible with the
" original vi as possible. Note that ~/.vimrc configuration files as other
" configuration files in the runtimepath are still sourced.
" When Vim is invoked differently ("vim", "view", "evim", ...) this file is
" _not_ sourced; /etc/vim/vimrc and/or /etc/vim/gvimrc are.

" Debian system-wide default configuration Vim
set runtimepath=~/.vim,/var/lib/vim/addons,/usr/share/vim/vimfiles,/usr/share/vim/vim72,/usr/share/vim/vimfiles/after,/var/lib/vim/addons/after,~/.vim/after

set compatible

" vim: set ft=vim:


Au niveau de ~/.vimrc :

" Default configuration file for Vim
" Written by Aron Griffis <agriffis@gentoo.org>
" Modified by Ryan Phillips <rphillips@gentoo.org>
" Modified some more by Ciaran McCreesh <ciaranm@gentoo.org>
" Added Redhat's vimrc info by Seemant Kulleen <seemant@gentoo.org>

" The following are some sensible defaults for Vim for most users.
" We attempt to change as little as possible from Vim's defaults, 
" deviating only where it makes sense                             
set nocompatible        " Use Vim defaults (much better!)         
set bs=2                " Allow backspacing over everything in insert mode
set ai                  " Always set auto-indenting on                    
"set backup             " Keep a backup file                              
set viminfo='20,\"500   " read/write a .viminfo file -- limit regs to 500 lines
set history=50          " keep 50 lines of command history                     
set ruler               " Show the cursor position all the time                
set bg=dark                                                                    

" We don't allow modelines by default. See bug #14088 and bug #73715.
" If you're not concerned about these, you can enable them on a per-user
" basis by adding "set modeline" to your ~/.vimrc file.                 
set nomodeline                                                          

if v:lang =~ "^ko"
  set fileencodings=euc-kr
  set guifontset=-*-*-medium-r-normal--16-*-*-*-*-*-*-*
elseif v:lang =~ "^ja_JP"                              
  set fileencodings=euc-jp                             
  set guifontset=-misc-fixed-medium-r-normal--14-*-*-*-*-*-*-*
elseif v:lang =~ "^zh_TW"                                     
  set fileencodings=big5                                      
  set guifontset=-sony-fixed-medium-r-normal--16-150-75-75-c-80-iso8859-1,-taipei-fixed-medium-r-normal--16-150-75-75-c-160-big5-0
elseif v:lang =~ "^zh_CN"                                                                                                         
  set fileencodings=gb2312                                                                                                        
  set guifontset=*-r-*                                                                                                            
endif                                                                                                                             
if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"                                                                                        
  set fileencodings=utf-8,latin1                                                                                                  
endif                                                                                                                             

" Don't use Ex mode, use Q for formatting
map Q gq                                 

" 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"
  " Previously we would unset t_RV to prevent gnome-terminal from beeping as
  " vim started.  These days it appears that gnome-terminal has been repaired,
  " so re-enable this, and don't restrict t_Co=8.  (21 Jun 2004 agriffis)     
  "set t_RV=                    " don't check terminal version                
  "set t_Co=8                                                                 
  set t_Sb=^[4%dm                                                             
  set t_Sf=^[3%dm                                                             
  set ttymouse=xterm2   " only works for >=xfree86-3.3.3, should be okay      
endif                                                                         

" Enable plugin-provided filetype settings
filetype plugin on                        

" Uncomment the next line (or copy to your ~/.vimrc) for plugin-provided
" indent settings. Some people don't like these, so we won't turn them on by 
" default.                                                                   
"filetype indent on                                                          

if has("autocmd")

augroup gentoo
  au!         

  " Gentoo-specific settings for ebuilds.  These are the federally-mandated
  " required tab settings.  See the following for more information:        
  " http://www.gentoo.org/doc/en/xml/gentoo-howto.xml                      
  " Better yet, emerge app-vim/gentoo-syntax and you'll get full syntax,   
  " filetype and indent settings for all things Gentoo.                    
  au BufRead,BufNewFile *.e{build,class} let is_bash=1|setfiletype sh      
  au BufRead,BufNewFile *.e{build,class} set ts=4 sw=4 noexpandtab         

  " In text files, limit the width of text to 78 characters, but be careful
  " that we don't override the user's setting.                             
  autocmd BufNewFile,BufRead *.txt if &tw == 0 | set tw=78 | endif         

  " When editing a file, always jump to the last cursor position
  autocmd BufReadPost *                                         
        \ if line("'\"") > 0 && line ("'\"") <= line("$") |     
        \   exe "normal g'\"" |                                 
        \ endif                                                 

  " When editing a crontab file, set backupcopy to yes rather than auto. See
  " :help crontab and bug 53437.                                            
  autocmd FileType crontab set backupcopy=yes                               

augroup END

endif " has("autocmd")
set ts=4              
set sw=4              
syn on                
set autoindent        
set cindent           
"set tw=78            
set nopaste           
"let spell_auto_type = "tex,mail,text,html,sgml,otl,cvs,none"
"setlocal spell spelllang=fr                                 
"                                                            

"augroup filetypedetect
"au BufNewFile,BufRead *.tex setlocal spell spelllang=fr
"augroup END

"  :set spelllang=en

" Toggle option 'spell'
" permet de d&#65533;sactiver la correction orthographique en appuyant sur f10
function! ToggleSpell()
  if &spell
    set nospell
  else
    set spell
  end
endfunction

noremap <F10> :call ToggleSpell()<cr>
inoremap <F10> <Esc>:call ToggleSpell()<cr>a
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" autocompletion c/c++
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

" pré-requis tags
set nocp
filetype plugin on

" Pour générer les ctags :
" Pour la STL: https://www.vim.org/scripts/script.php?script_id=2358
" Taper dans un terminal :
"  ctags -R --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++ cpp_src && mv tags stl
"
" Pour les autres librairies : (opengl, sld, qt)
"  ctags -R --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++ /usr/include/GL/  && mv tags gl 
"  ctags -R --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++ /usr/include/SDL/ && mv tags sdl
"  ctags -R --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++ /usr/include/qt4/ && mv tags qt4
"

" configure tags - add additional tags here or comment out not-used ones
"set tags+=~/.vim/tags/stl
"set tags+=~/.vim/tags/gl
"set tags+=~/.vim/tags/sdl
"set tags+=~/.vim/tags/qt4

" build tags of your own project with CTRL+F12
"map <C-F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
noremap <F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<cr>
inoremap <F12> <Esc>:!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<cr>

" OmniCppComplete
let OmniCpp_NamespaceSearch = 1
let OmniCpp_GlobalScopeSearch = 1
let OmniCpp_ShowAccess = 1
let OmniCpp_MayCompleteDot = 1
let OmniCpp_MayCompleteArrow = 1
let OmniCpp_MayCompleteScope = 1
let OmniCpp_DefaultNamespaces = ["std", "_GLIBCXX_STD"]

" automatically open and close the popup menu / preview window
au CursorMovedI,InsertLeave * if pumvisible() == 0|silent! pclose|endif
set completeopt=menuone,menu,longest,preview


J'espère que ça t'aidera.

Bonne chance
0