GNU bug report logs - #9318
23.3.50; The first call of encode-coding-region() returns wrong result on on Windows

Previous Next

Package: emacs;

Reported by: Kazuhiro Ito <kzhr <at> d1.dion.ne.jp>

Date: Thu, 18 Aug 2011 09:04:02 UTC

Severity: normal

Found in version 23.3.50

Fixed in version 24.0.93

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Kazuhiro Ito <kzhr <at> d1.dion.ne.jp>
To: 9318 <at> debbugs.gnu.org
Subject: bug#9318: 23.3.50; The first call of encode-coding-region() returns wrong result on on Windows
Date: Thu, 18 Aug 2011 18:01:13 +0900
When I start Emacs and evaluate the below code, unexpected result returns.

(let ((func (lambda ()
	      (with-temp-buffer
		(mapc 'insert '(166 25339))
		(encode-coding-region (point-min) (point-max) 'ctext-unix)
		(buffer-string)))))
  (cons (funcall func)
	(funcall func)))
-> ("¦拻^@^@^@^@^@^@^@^@^@^@" . "^[$(D\"C^[$(H*f^[(B") 

car of the result is not constant.  In the worst case, emacs
crashes.  It doesn't occur on Linux.  If I evaluate twice, car and cdr
of the last result are correct.  Using encode-coding-string instead of
encode-coding-region has no problem. 

(let ((func (lambda ()
	      (encode-coding-string
	       (mapconcat 'char-to-string '(166 25339) "")
	       'ctext-unix))))
  (cons (funcall func)
	(funcall func)))
-> ("^[$(D\"C^[$(H*f^[(B" . "^[$(D\"C^[$(H*f^[(B")

Before calling encode-coding-string also can avoid problem.

(let ((func (lambda ()
	      (with-temp-buffer
		(mapc 'insert '(166 25339))
		(encode-coding-region (point-min) (point-max) 'ctext-unix)
		(buffer-string)))))
  (encode-coding-string
   (mapconcat 'char-to-string '(166 25339) "") 'ctext-unix)
  (cons (funcall func)
	(funcall func)))
-> ("^[$(D\"C^[$(H*f^[(B" . "^[$(D\"C^[$(H*f^[(B")

-- 
Kazuhiro Ito




This bug report was last modified 13 years and 170 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.