From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Third Newsgroups: gmane.emacs.bugs Subject: bug#42904: [PATCH] Non-Unicode frame title crashes Emacs on macOS Date: Mon, 17 Aug 2020 21:56:13 +0200 (CEST) Message-ID: <20200817195610.GA70682@breton.holly.idiocy.org> References: <83lfidgtc7.fsf@gnu.org> <838sedgq2x.fsf@gnu.org> <02F52D43-7EAB-4E61-A567-E8CCD11D856B@acm.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17585"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 42904@debbugs.gnu.org To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 17 21:57:09 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k7lFl-0004Sn-Dw for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 17 Aug 2020 21:57:09 +0200 Original-Received: from localhost ([::1]:52438 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k7lFk-00021C-GO for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 17 Aug 2020 15:57:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35904) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k7lFe-000212-1B for bug-gnu-emacs@gnu.org; Mon, 17 Aug 2020 15:57:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49913) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k7lFd-0005sd-Om for bug-gnu-emacs@gnu.org; Mon, 17 Aug 2020 15:57:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1k7lFd-00074m-NK for bug-gnu-emacs@gnu.org; Mon, 17 Aug 2020 15:57:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 17 Aug 2020 19:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42904 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 42904-submit@debbugs.gnu.org id=B42904.159769418427156 (code B ref 42904); Mon, 17 Aug 2020 19:57:01 +0000 Original-Received: (at 42904) by debbugs.gnu.org; 17 Aug 2020 19:56:24 +0000 Original-Received: from localhost ([127.0.0.1]:33226 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k7lF2-00073w-GO for submit@debbugs.gnu.org; Mon, 17 Aug 2020 15:56:24 -0400 Original-Received: from mailout-l3b-97.contactoffice.com ([212.3.242.97]:43912) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k7lF0-00073i-W9 for 42904@debbugs.gnu.org; Mon, 17 Aug 2020 15:56:23 -0400 Original-Received: from smtpauth1.co-bxl (smtpauth1.co-bxl [10.2.0.15]) by mailout-l3b-97.contactoffice.com (Postfix) with ESMTP id 8349B227; Mon, 17 Aug 2020 21:56:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1597694176; s=20200222-6h9o; d=idiocy.org; i=alan@idiocy.org; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:Content-Type:Content-Transfer-Encoding:In-Reply-To; l=1317; bh=xPeYLyIC5/wSRe4CYSHZJ/dlZ7FY8tA3i6HZycfGbHs=; b=jGcNquf18gwzkMirIZpFajVgVYjuWol6NYkiB44VVkXRcDGD4NDq1w1dRjE0uAx1 ouPSdVjBU5WMnYPqridRf4P9Xh3iX6Q2mzv4Js7VO0OjiCkgjunchZGnDPBlYNpjsiw iMTlTdrKW4B/38wNWRTTezWk7L+QoPnuv7O3qziWetxN4ohc6ftydhG5Oo7lh6EWMFF n+TgjKq5JwkS+pcx+z7XcR5lkWYVKGhvIhN58NvKhC/GHMOCEzTdINydOtKEPCYk/hu HKfSo8bUXLfYjclbsgUnZRBnwRmQB1ELyIfDR5yeQyCYOF4EKQJau788ra/KUpDtZ3C qLd5hz7UeQ== Original-Received: by smtp.mailfence.com with ESMTPA ; Mon, 17 Aug 2020 21:56:12 +0200 (CEST) Original-Received: by breton.holly.idiocy.org (Postfix, from userid 501) id BEBF8202496C67; Mon, 17 Aug 2020 20:56:10 +0100 (BST) Mail-Followup-To: Alan Third , Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= , Eli Zaretskii , 42904@debbugs.gnu.org Content-Disposition: inline In-Reply-To: <02F52D43-7EAB-4E61-A567-E8CCD11D856B@acm.org> X-ContactOffice-Account: com:241649512 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:185413 Archived-At: On Mon, Aug 17, 2020 at 08:48:08PM +0200, Mattias Engdegård wrote: > 17 aug. 2020 kl. 19.05 skrev Eli Zaretskii : > > > Well, it is always easier to special-case some use case, but we have > > general APIs for a reason. In particular, having several similar but > > subtly different functions is confusing and causes mistakes. > > The new function is much simpler and easier to use than > encode_string_utf_8 precisely for that reason: to avoid confusion > and mistakes, both of which I got in spades when trying to use it. Sorry if this is a stupid question, but would using UTF-16 be easier? This appears to work (although I'm sure it's not the right way to do this): modified src/nsfns.m @@ -405,11 +405,10 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side. NSString *str; NSView *view = FRAME_NS_VIEW (f); + encoded_name = code_convert_string_norecord (name, Qutf_16le, 1); - encoded_name = ENCODE_UTF_8 (name); - - str = [NSString stringWithUTF8String: SSDATA (encoded_name)]; - + str = [NSString stringWithCharacters: (const unichar *) SDATA (encoded_name) + length: SBYTES (encoded_name) / sizeof (unichar)]; /* Don't change the name if it's already NAME. */ if (! [[[view window] title] isEqualToString: str]) -- Alan Third