[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-29 f063f79a493: Convert NUL-containing NSString objects to Lisp st
From: |
Mattias Engdegård |
Subject: |
emacs-29 f063f79a493: Convert NUL-containing NSString objects to Lisp strings correctly |
Date: |
Tue, 18 Jul 2023 09:53:49 -0400 (EDT) |
branch: emacs-29
commit f063f79a4933f21dc72c6a24b60f98197543d3de
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>
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.
---
src/nsfns.m | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/nsfns.m b/src/nsfns.m
index 8804a7df7cf..5ae2cc77bb2 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- emacs-29 f063f79a493: Convert NUL-containing NSString objects to Lisp strings correctly,
Mattias Engdegård <=