« Return to Thread: Problem in a unicode project

Re: Problem in a unicode project

by Wei Dai :: Rate this Message:

Reply to Author | View in Thread


Eugene Zolenko wrote:
> On windows you can use non-standard extention to fstreams -- they can
> be created from FILE handles, and FILEs can be created using _wfopen.
> And FileSink/Source can be created using fstreams.
>
> std::wstring path = L"D:\bla.txt";
> FILE* handle = _wfopen(path, L"rb");
> std::ifstream file(handle);
> CryptoPP::FileSource(file, ...);

It turns out that ifstream::open in MSVC 2005 and later can handle a Unicode
filename directly.

> On Linux you will have to convert you std::wstring into UTF8 encoded
> std::string first. (Using your favorite UTF8 conversion libraries :)).

wcstombs() can be used for this, and it seems to be a standard Unix
function.

I've checked in changes to enable FileSource, FileSink, and FileStore to
handle Unicode filenames on Unix and MSVC 2005 and later using the above
methods. Please take a look at
http://cryptopp.svn.sourceforge.net/viewvc/cryptopp?view=rev&revision=472 if
you'd like to review the code.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the "Crypto++ Users" Google Group.
To unsubscribe, send an email to cryptopp-users-unsubscribe@....
More information about Crypto++ and this group is available at http://www.cryptopp.com.
-~----------~----~----~----~------~----~------~--~---

 « Return to Thread: Problem in a unicode project