From: Austin Clements <amdragon@mit.edu>
To: Martin Owens <doctormo@gmail.com>
Cc: Notmuch developer list <notmuch@notmuchmail.org>
Subject: Re: Unicode Paths
Date: Thu, 15 Sep 2011 13:52:12 -0400 [thread overview]
Message-ID: <CAH-f9WtL4Lwrf2qSzpgeLL5nA_2_mFxUm6cFLmfO9UK_aKmCkg@mail.gmail.com> (raw)
In-Reply-To: <1315972539.2201.11.camel@delen>
On Tue, Sep 13, 2011 at 11:55 PM, Martin Owens <doctormo@gmail.com> wrote:
> Hello Again,
>
> I notice in the lib code notmuch_database_open(),
> notmuch_database_create() these functions use const char *path for the
> directory path input. Is this unicode safe?
>
> The python bindings (and ctype docs) seem to suggest using something
> called 'wchar_t *' for accepting unicode but that's for C not C++.
>
> Is this something that should be patched?
char* is the correct type for paths on POSIX systems. The *meaning*
of those bytes is a more complicated matter and depends on your locale
settings. On old systems it was generally ASCII, on modern systems
it's generally UTF-8, and it can be many other things. However, as a
consequence of UNIX's C heritage, it is *always* terminated with a
NULL byte and cannot contain embedded NULL's. Any encoding that
doesn't satisfy this would not be a valid encoding for file names (you
couldn't even pass such a file name to the open() system call, because
it expects a NULL-terminated byte string).
wchar_t is another matter entirely. wchar_t is the type used by C to
represent wide strings internally, which generally (but not
necessarily!) means it stores a Unicode code point. However, this
isn't an encoding, and different compilers can give wchar_t different
meanings, so wchar_t strings aren't generally appropriate for storing
or sharing between processes or with the kernel.
next prev parent reply other threads:[~2011-09-15 17:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-14 3:55 Unicode Paths Martin Owens
2011-09-14 4:38 ` Kan-Ru Chen
2011-09-15 16:52 ` Martin Owens
2011-09-15 17:52 ` Austin Clements [this message]
2011-09-16 10:58 ` Sebastian Spaeth
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
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAH-f9WtL4Lwrf2qSzpgeLL5nA_2_mFxUm6cFLmfO9UK_aKmCkg@mail.gmail.com \
--to=amdragon@mit.edu \
--cc=doctormo@gmail.com \
--cc=notmuch@notmuchmail.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 public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).