From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: [wenbinye@gmail.com: hexl-max-address in hexl-mode is incorrect] Date: Wed, 22 Nov 2006 11:59:14 -0500 Message-ID: <87bqmzo1st.fsf@cyd.mit.edu> References: <87bqmzo4fl.fsf@cyd.mit.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1164214831 13982 80.91.229.2 (22 Nov 2006 17:00:31 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 22 Nov 2006 17:00:31 +0000 (UTC) Cc: rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Nov 22 18:00:29 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GmvSR-0005yS-KC for ged-emacs-devel@m.gmane.org; Wed, 22 Nov 2006 18:00:23 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GmvSR-0007Yh-A4 for ged-emacs-devel@m.gmane.org; Wed, 22 Nov 2006 12:00:23 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GmvR9-0006Rn-Os for emacs-devel@gnu.org; Wed, 22 Nov 2006 11:59:03 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GmvR8-0006Pj-3i for emacs-devel@gnu.org; Wed, 22 Nov 2006 11:59:03 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GmvR7-0006PN-R2 for emacs-devel@gnu.org; Wed, 22 Nov 2006 11:59:01 -0500 Original-Received: from [18.19.1.138] (helo=cyd.mit.edu) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GmvR6-0005NB-67; Wed, 22 Nov 2006 11:59:00 -0500 Original-Received: by cyd.mit.edu (Postfix, from userid 1000) id 65FC84E453; Wed, 22 Nov 2006 11:59:14 -0500 (EST) Original-To: "Ye Wenbin" In-Reply-To: <87bqmzo4fl.fsf@cyd.mit.edu> (Chong Yidong's message of "Wed\, 22 Nov 2006 11\:02\:22 -0500") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.91 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:62678 Archived-At: >> The hexl-max-address usually set to buffer-size, but when the buffer >> contain a multiple byte character or the file associated to the buffer >> is encoded by multibyte coding system such as utf-16, the >> hexl-max-address is usually less the the real byte of buffer. > > However, the (decode-coding-string (buffer-string) buffer-file-coding-system) > method doesn't seem to work for me; it returns erratic incorrect > results. Actually, I think the correct thing to do is to ENcode the buffer string, not DEcode it. (length (encode-coding-string (buffer-string) buffer-file-coding-system)) This seems to produce the correct results.