emacs-devel
[Top][All Lists]
Advanced

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

Re: Fcall_process: wrong conversion


From: Stefan Monnier
Subject: Re: Fcall_process: wrong conversion
Date: Mon, 15 May 2006 12:06:48 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

>    - Create a file contains UTF-16 text, either UTF-16BE or UTF-16LE
>      is OK.  For example, create a file contains "a" in UTF-16LE as
>      its content and name this file with "1".
[...]
>    - In case the buffer is encoded with utf-16-le, the content is
>      displayed as "a".  Type M-x hexl-mode RET, the result is

>          \377?: Invalid argument

>      displayed in the buffer.

Thanks.  I've installed the patch below which should fix the problem.
Please confirm,


        Stefan


--- hexl.el     11 avr 2006 12:45:49 -0400      1.103
+++ hexl.el     15 mai 2006 12:02:32 -0400      
@@ -704,7 +704,12 @@
        (buffer-undo-list t))
     (apply 'call-process-region (point-min) (point-max)
           (expand-file-name hexl-program exec-directory)
-          t t nil (split-string hexl-options))
+          t t nil
+           ;; Manually encode the args, otherwise they're encoded using
+           ;; coding-system-for-write (i.e. buffer-file-coding-system) which
+           ;; may not be what we want (e.g. utf-16 on a non-utf-16 system).
+           (mapcar (lambda (s) (encode-coding-string s locale-coding-system))
+                   (split-string hexl-options)))
     (if (> (point) (hexl-address-to-marker hexl-max-address))
        (hexl-goto-address hexl-max-address))))
 




reply via email to

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