[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Fwd: LMDB and text encoding
- To: openldap-devel@openldap.org
- Subject: Fwd: LMDB and text encoding
- From: Timur Kristóf <timur.kristof@gmail.com>
- Date: Mon, 2 Feb 2015 11:52:04 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=eOpe/hBJGdfA9f/Iq6PoJQ0hDwY6UtHsVV8R13mca00=; b=t6cIQOQnEJZlMgcpBgCR43PkxkSIKP9S0+1BsVmdH6UB3xgQtNynkkzsL8JVhugdAl 43REhFuGJjigWPyZWsXAMAthPo1sCGQo6ITM+VwT/V/mpJa6juH4IrWn7rbmPH32cGdD aJQkSwpXEDr8bhCZ2pukIHFl3kPbCPaKQe71huA8U6LnKbH6fs338qaGBBMxDVZVWTLM /dnR3pWMOQyZMIfKgqm1L6O/r0raK0U7QJkhnKQQzQ/QWY44VqdusBmmZWVAowJ0nXeD XvvWesfYYDX2rXpntGCBzBc2HDTUwUxPVrGlnmAHyPaC8yA/HeBV3SeiMCVpMV+YM1vA rDwg==
- In-reply-to: <CAFF-SiW0VG6W0jMC=VrJgSTTL2S6bRAkKr25a3GFbF8JuCFS=w@mail.gmail.com>
- References: <CAFF-SiUrJKGvG_z5vKgn13KX6oSbWQmLDj0VqGXMsuzJT5JBEg@mail.gmail.com> <54CEE7F1.5020601@symas.com> <CAFF-SiW0VG6W0jMC=VrJgSTTL2S6bRAkKr25a3GFbF8JuCFS=w@mail.gmail.com>
> I just had a look at how BDB handled this. As you can see they used a
> TO_TSTRING macro to convert incoming pathnames from UTF8 to UTF16.
>
> https://gitorious.org/berkeleydb/berkeleydb/source/347d239a1e44ed4f773ae9274c2a32cf2b8999c0:src/os_windows/os_open.c
>
> https://gitorious.org/berkeleydb/berkeleydb/source/347d239a1e44ed4f773ae9274c2a32cf2b8999c0:src/dbinc/win_db.h#L136
>
> (And a FROM_TSTRING for the reverse, as well.)
(Mea culpa, I accidentally hit "reply" instead of "reply all". Sorry.
Now reposting to the mailing list.)
Since we only need to do this on Windows, we could use
MultiByteToWideChar with CP_UTF8. (That's what TO_TSTRING does, too.)
I do not think we would ever need to do any such conversion on UNIX.
https://msdn.microsoft.com/en-us/library/windows/desktop/dd319072%28v=vs.85%29.aspx
I'm not sure if we can just copy-paste BDB's code. Probably not, that
would lead to licensing issues, wouldn't it?