diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2023-07-18 15:42:55 +0200 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2023-07-18 15:51:37 +0200 |
commit | f063f79a4933f21dc72c6a24b60f98197543d3de (patch) | |
tree | 0ef4f44c9354129285920608b3bb41ca53dec71a /src/nsfns.m | |
parent | d172cd59854699c00de3b57a91e48ff70a4210f8 (diff) | |
download | emacs-f063f79a4933f21dc72c6a24b60f98197543d3de.tar.gz emacs-f063f79a4933f21dc72c6a24b60f98197543d3de.tar.bz2 emacs-f063f79a4933f21dc72c6a24b60f98197543d3de.zip |
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.
Diffstat (limited to 'src/nsfns.m')
-rw-r--r-- | src/nsfns.m | 4 |
1 files changed, 3 insertions, 1 deletions
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 |