Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 96018431FD0 for ; Thu, 15 Sep 2011 10:52:13 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.699 X-Spam-Level: X-Spam-Status: No, score=-0.699 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GIbpU4CVgaz2 for ; Thu, 15 Sep 2011 10:52:13 -0700 (PDT) Received: from mail-qw0-f46.google.com (mail-qw0-f46.google.com [209.85.216.46]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 19AD3431FB6 for ; Thu, 15 Sep 2011 10:52:13 -0700 (PDT) Received: by qwj8 with SMTP id 8so1130479qwj.5 for ; Thu, 15 Sep 2011 10:52:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=9uJgo4R9NEYEKKJOJ+iVYNX5ZOPJimDcGFpC/8fglJ0=; b=B5FTNgwfk2kwkaf2/34JA9R6TnZCybbKrvXFkYqnlTiqMqYzz/4TxrI5cVes6pOzRe UIiJRBFAldiLx+Mz6ZNJQJ1tHFkrgYXaQf2gSz6M1aBT98rUU853RMS0qAa7UYKhxtzX MIm0OT2l4liJyDj23UYQbC9NDd3gYwQu4nMnk= MIME-Version: 1.0 Received: by 10.229.73.25 with SMTP id o25mr1003542qcj.26.1316109132545; Thu, 15 Sep 2011 10:52:12 -0700 (PDT) Sender: amdragon@gmail.com Received: by 10.229.2.201 with HTTP; Thu, 15 Sep 2011 10:52:12 -0700 (PDT) In-Reply-To: <1315972539.2201.11.camel@delen> References: <1315972539.2201.11.camel@delen> Date: Thu, 15 Sep 2011 13:52:12 -0400 X-Google-Sender-Auth: mDAFz-C1lMrSYO4Mc494mUL0g_Q Message-ID: Subject: Re: Unicode Paths From: Austin Clements To: Martin Owens Content-Type: text/plain; charset=ISO-8859-1 Cc: Notmuch developer list X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2011 17:52:13 -0000 On Tue, Sep 13, 2011 at 11:55 PM, Martin Owens 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.