GNU bug report logs -
#42904
[PATCH] Non-Unicode frame title crashes Emacs on macOS
Previous Next
Reported by: Mattias Engdegård <mattiase <at> acm.org>
Date: Mon, 17 Aug 2020 14:13:02 UTC
Severity: normal
Tags: patch
Merged with 41184
Found in version 28.0.50
Done: Mattias Engdegård <mattiase <at> acm.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On Mon, Aug 17, 2020 at 08:48:08PM +0200, Mattias Engdegård wrote:
> 17 aug. 2020 kl. 19.05 skrev Eli Zaretskii <eliz <at> gnu.org>:
>
> > 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
This bug report was last modified 4 years and 269 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.