From: Robert Pluim <rpluim@gmail.com>
To: "Zhu Zihao" <all_but_last@163.com>
Cc: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: Re: Is copy_string_contents in emacs-module.h give us a proper UTF-8 string?
Date: Thu, 08 Oct 2020 09:40:02 +0200 [thread overview]
Message-ID: <m24kn588tp.fsf@gmail.com> (raw)
In-Reply-To: <79bc0bc2.1982.17506d48b4d.Coremail.all_but_last@163.com> (Zhu Zihao's message of "Thu, 8 Oct 2020 14:09:53 +0800 (CST)")
>>>>> On Thu, 8 Oct 2020 14:09:53 +0800 (CST), "Zhu Zihao" <all_but_last@163.com> said:
Zhu> I see the comment in emacs-module.h says
Zhu> /* Copy the content of the Lisp string VALUE to BUFFER as an utf8
Zhu> NUL-terminated string.
Zhu> SIZE must point to the total size of the buffer. If BUFFER is
Zhu> NULL or if SIZE is not big enough, write the required buffer size
Zhu> to SIZE and return true.
Zhu> Note that SIZE must include the last NUL byte (e.g. "abc" needs
Zhu> a buffer of size 4).
Zhu> Return true if the string was successfully copied. */
From emacs-module.c:module_copy_string_contents:
We set HANDLE-8-BIT and HANDLE-OVER-UNI to nil to signal an error
if the argument is not a valid Unicode string. While it isn't
documented how copy_string_contents behaves in this case,
signaling an error is the most defensive and obvious reaction. */
Zhu> Will "copy_string_contents" always give us a proper UTF-8 string. Or it will give us a mix of bytevector and UTF8?
It will either give a UTF-8 string or signal an error.
Robert
--
prev parent reply other threads:[~2020-10-08 7:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-08 6:09 Is copy_string_contents in emacs-module.h give us a proper UTF-8 string? Zhu Zihao
2020-10-08 7:38 ` Eli Zaretskii
2020-10-08 7:40 ` Robert Pluim [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m24kn588tp.fsf@gmail.com \
--to=rpluim@gmail.com \
--cc=all_but_last@163.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.