[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master f48e47fb49e: ; [NSString lispString]: clarify unpaired surrogate
From: |
Mattias Engdegård |
Subject: |
master f48e47fb49e: ; [NSString lispString]: clarify unpaired surrogate behaviour |
Date: |
Thu, 10 Aug 2023 05:17:27 -0400 (EDT) |
branch: master
commit f48e47fb49e1e552a6e63ae13e9b4b76722ec598
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>
; [NSString lispString]: clarify unpaired surrogate behaviour
---
src/nsfns.m | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/nsfns.m b/src/nsfns.m
index 508568d90c3..b846b490ff7 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -3797,7 +3797,7 @@ all_nonzero_ascii (unsigned char *str, ptrdiff_t n)
}
/* Count the number of characters in STR, NBYTES long.
- The string is valid UTF-8 except that it may contain unpaired surrogates.
*/
+ The string must be valid UTF-8. */
static ptrdiff_t
count_utf8_chars (const char *str, ptrdiff_t nbytes)
{
@@ -3861,6 +3861,8 @@ count_utf8_chars (const char *str, ptrdiff_t nbytes)
/* Make a Lisp string from an NSString. */
- (Lisp_Object)lispString
{
+ /* If the input string includes unpaired surrogates, then the result
+ will be an empty string. */
const char *utf8 = [self UTF8String];
ptrdiff_t bytes = [self lengthOfBytesUsingEncoding: NSUTF8StringEncoding];
return make_multibyte_string (utf8, count_utf8_chars (utf8, bytes), bytes);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master f48e47fb49e: ; [NSString lispString]: clarify unpaired surrogate behaviour,
Mattias Engdegård <=