Currently I have to deal with some files from Windows on Linux. Those files are encoded in 'cp936', which is a Chinese encoding schema on Windows, and it can be decode properly on Windows using vim, in which I see the encoding name 'cp936'.

However, when on Linux, vim didn't decode those file properly. At first, vim automatically decoded those files using 'latin-1', which of course didn't work. Then I manually change the encoding to 'cp936' using command 'set encoding=cp936'. But it didn't work either. Then I try 'set fileencoding=cp936', the same.

Can anyone tell me why the same file is treated differently by vim when I set the same encode/decode schema ? On Windows, vim decode properly with the 'cp936' schema, but on Linux, it just doesn't work. Isn't that weird? Or is there anything that I did wrong ?

Also, I have tried to decode that message with Python, and it work expectedly:
        f=open("file_name","r")
        text=f.read()
        print text.decode('cp936')

I have attached a sample file, if anyone may be interested.

--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
         ;´úÂëÇåµ¥6-1
         ;ÎļþÃû£ºc06_mbr.asm
         ;Îļþ˵Ã÷£ºÓ²ÅÌÖ÷Òýµ¼ÉÈÇø´úÂë
         ;´´½¨ÈÕÆÚ£º2011-4-12 22:12 
      
         jmp near start
         
  mytext db 'L',0x07,'a',0x07,'b',0x07,'e',0x07,'l',0x07,' ',0x07,'o',0x07,\
            'f',0x07,'f',0x07,'s',0x07,'e',0x07,'t',0x07,':',0x07
  number db 0,0,0,0,0
  
  start:
         mov ax,0x7c0                  ;ÉèÖÃÊý¾Ý¶Î»ùµØÖ· 
         mov ds,ax
         
         mov ax,0xb800                 ;ÉèÖø½¼Ó¶Î»ùµØÖ· 
         mov es,ax
         
         cld
         mov si,mytext                 
         mov di,0
         mov cx,(number-mytext)/2      ;ʵ¼ÊÉϵÈÓÚ 13
         rep movsw
     
         ;µÃµ½±êºÅËù´ú±íµÄÆ«ÒÆµØÖ·
         mov ax,number
         
         ;¼ÆËã¸÷¸öÊýλ
         mov bx,ax
         mov cx,5                      ;Ñ­»·´ÎÊý 
         mov si,10                     ;³ýÊý 
  digit: 
         xor dx,dx
         div si
         mov [bx],dl                   ;±£´æÊýλ
         inc bx 
         loop digit
         
         ;ÏÔʾ¸÷¸öÊýλ
         mov bx,number 
         mov si,4                      
   show:
         mov al,[bx+si]
         add al,0x30
         mov ah,0x04
         mov [es:di],ax
         add di,2
         dec si
         jns show
         
         mov word [es:di],0x0744

         jmp near $

  times 510-($-$$) db 0
                   db 0x55,0xaa

Raspunde prin e-mail lui