bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Spurious characters in hexl-mode


From: Eli Zaretskii
Subject: Re: Spurious characters in hexl-mode
Date: Tue, 4 Sep 2001 15:02:09 +0300 (IDT)

On Tue, 4 Sep 2001 Steven.Murdoch@reuters.com wrote:

> I have been editing a UTF-8 document which now appears to be invalid, 
> in order to check this fact I switched to hexl-mode and a spurious 
> character appeared. I have reduced the file to 4 bytes for the purposes 
> of showing this problem. In text-mode exactly 4 characters are shown and 
> are rendered correctly assuming the file is in iso-8859-1 (which is what 
> I would expect) - namely: capital K (0x4b), capital A-tilde (0xc3), 
> question mark (0x3f), capital B (0x42). In hexl-mode however 5 bytes are 
> shown, "4b81 c33f 42". The 0x81 character is not present in the input 
> file. The ASCII view in hexl-mode corresponds to the hex view, i.e. 
> "K..?B"

Thank you for your report.

This is a known problem in Emacs 20.7 which is already corrected in the 
current development sources.  I believe that the change below will fix it 
for you, until the next version is released.

Index: lisp/hexl.el
===================================================================
RCS file: /cvs/emacs/lisp/hexl.el,v
retrieving revision 1.61
retrieving revision 1.62
diff -c -r1.61 -r1.62
*** lisp/hexl.el        2000/04/19 19:10:46     1.61
--- lisp/hexl.el        2000/10/11 17:08:28     1.62
***************
*** 600,616 ****
    (setq buffer-undo-list nil)
    ;; Don't decode text in the ASCII part of `hexl' program output.
    (let ((coding-system-for-read 'raw-text)
!       ;; If the buffer was read with EOL conversions, be sure to use the
!       ;; same conversions when passing the region to the `hexl' program.
!       (coding-system-for-write
!        (let ((eol-type (coding-system-eol-type buffer-file-coding-system)))
!          (cond ((eq eol-type 1)
!                 'raw-text-dos)
!                ((eq eol-type 2)
!                 'raw-text-mac)
!                ((eq eol-type 0)
!                 'raw-text-unix)
!                (t 'no-conversion))))
        (buffer-undo-list t))
      (shell-command-on-region (point-min) (point-max) hexlify-command t)
      (if (> (point) (hexl-address-to-marker hexl-max-address))
--- 600,606 ----
    (setq buffer-undo-list nil)
    ;; Don't decode text in the ASCII part of `hexl' program output.
    (let ((coding-system-for-read 'raw-text)
!       (coding-system-for-write buffer-file-coding-system)
        (buffer-undo-list t))
      (shell-command-on-region (point-min) (point-max) hexlify-command t)
      (if (> (point) (hexl-address-to-marker hexl-max-address))
***************
*** 625,639 ****
           (error "Aborted")))
    (setq buffer-undo-list nil)
    (let ((coding-system-for-write 'raw-text)
!       (coding-system-for-read
!        (let ((eol-type (coding-system-eol-type buffer-file-coding-system)))
!          (cond ((eq eol-type 1)
!                 'raw-text-dos)
!                ((eq eol-type 2)
!                 'raw-text-mac)
!                ((eq eol-type 0)
!                 'raw-text-unix)
!                (t 'no-conversion))))
        (buffer-undo-list t))
      (shell-command-on-region (point-min) (point-max) dehexlify-command t)))
  
--- 615,621 ----
           (error "Aborted")))
    (setq buffer-undo-list nil)
    (let ((coding-system-for-write 'raw-text)
!       (coding-system-for-read buffer-file-coding-system)
        (buffer-undo-list t))
      (shell-command-on-region (point-min) (point-max) dehexlify-command t)))
  



reply via email to

[Prev in Thread] Current Thread [Next in Thread]