From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Pascal J. Bourguignon" Newsgroups: gmane.emacs.help Subject: Re: Differences between identical strings in Emacs lisp Date: Tue, 07 Apr 2015 02:10:09 +0200 Organization: Informatimago Message-ID: <87pp7gu7by.fsf@kuiper.lan.informatimago.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1428366023 30182 80.91.229.3 (7 Apr 2015 00:20:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 7 Apr 2015 00:20:23 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Apr 07 02:20:19 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YfHFa-0008NG-LD for geh-help-gnu-emacs@m.gmane.org; Tue, 07 Apr 2015 02:20:18 +0200 Original-Received: from localhost ([::1]:42313 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YfHFZ-0000Vx-CR for geh-help-gnu-emacs@m.gmane.org; Mon, 06 Apr 2015 20:20:17 -0400 Original-Path: usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 46 Original-X-Trace: individual.net j3HeVw2Uc0GKmoCbN6oKEgbn58q+oyMIVnzZXuarYvSwrKneoZ Cancel-Lock: sha1:YzJjMjA0YjE1M2E4MGJkOTRkN2QyZTg4NTI3MzliZjY2ZDBlZmE3NQ== sha1:DszvPZVgjQA8NttNye+8Z8z6Kd8= Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Original-Xref: usenet.stanford.edu gnu.emacs.help:211270 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:103552 Archived-At: Jürgen Hartmann writes: > What is the difference between the string represented by the constant "\xBA" > and the result of (concat '(#xBA))? (mapcar 'multibyte-string-p (list "\xBA" (concat '(#xBA)))) --> (nil t) string-equal (and therefore string=) don't ignore the multibyte property of a string. You can use: (mapcar 'string-as-unibyte (list "\xBA" (concat '(#xBA)))) --> ("\272" "\302\272") to see the difference. Now, it's hard to say how to "solve" this problem, basically, you asked for it: "\xBA" is not a valid way to write a string containing masculine ordinal. I guess you could extract back the bytes, and recreate the string correctly: (map 'string 'identity (map 'list 'identity "\xBA")) --> "º" (string= (map 'string 'identity (map 'list 'identity "\xBA")) (concat '(#xBA))) --> t (On the other hand, one might argue that having both unibyte and multibyte strings in a lisp implementation is not a good idea, and there's the opportunity for a big refactoring and simplification). -- __Pascal Bourguignon__ http://www.informatimago.com/ “The factory of the future will have only two employees, a man and a dog. The man will be there to feed the dog. The dog will be there to keep the man from touching the equipment.” -- Carl Bass CEO Autodesk