[Date Prev][Date Next] [Chronological] [Thread] [Top]

Fwd: LMDB and text encoding



> 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?