unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#9318: 23.3.50; The first call of encode-coding-region() returns wrong result on on Windows
@ 2011-08-18  9:01 Kazuhiro Ito
  2011-08-18  9:48 ` Andreas Schwab
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Kazuhiro Ito @ 2011-08-18  9:01 UTC (permalink / raw)
  To: 9318


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





^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2011-12-06  0:30 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-18  9:01 bug#9318: 23.3.50; The first call of encode-coding-region() returns wrong result on on Windows Kazuhiro Ito
2011-08-18  9:48 ` Andreas Schwab
2011-08-18 21:33   ` Kazuhiro Ito
2011-08-19 13:46 ` bug#9318: 23.3.50; The first call of encode-coding-region() returns wrong result Kazuhiro Ito
2011-08-20 21:26   ` Chong Yidong
2011-08-21  0:17     ` Kazuhiro Ito
2011-08-24  9:37       ` Kazuhiro Ito
2011-08-24 12:06         ` Eli Zaretskii
2011-08-25  9:49           ` Kazuhiro Ito
2011-08-24 17:59         ` Andreas Schwab
2011-08-25  9:54           ` Kazuhiro Ito
2011-08-26 11:41             ` Kazuhiro Ito
2011-08-28  0:04               ` Kazuhiro Ito
2011-08-30 23:30                 ` Kazuhiro Ito
2011-12-01  1:56                   ` Kenichi Handa
2011-12-05  7:10                     ` Kenichi Handa
2011-12-05 11:31                       ` Kazuhiro Ito
2011-12-05  9:11 ` Paul Eggert
2011-12-06  0:30   ` Kenichi Handa

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).