Convert NUL-containing NSString objects to Lisp strings correctly
This cures the inability to paste text containing NUL from other
applications on macOS, introduced by mistake in 7e3c2b553f
(bug#64697).
* src/nsfns.m ([NSString lispString]): Use make_string instead of
build_string which relies on NUL-termination.
This commit is contained in:
@@ -3829,7 +3829,9 @@ all_nonzero_ascii (unsigned char *str, ptrdiff_t n)
|
||||
/* Make a Lisp string from an NSString. */
|
||||
- (Lisp_Object)lispString
|
||||
{
|
||||
return build_string ([self UTF8String]);
|
||||
// make_string behaves predictably and correctly with UTF-8 input.
|
||||
return make_string ([self UTF8String],
|
||||
[self lengthOfBytesUsingEncoding: NSUTF8StringEncoding]);
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user