Thanks, the class is useful for my project.

On Jun 26, 10:51 am, Eugene Zolenko <[email protected]> wrote:
> Actually somebody did create Source/Sink based on CFile (MFC). If you
> only use windows and can use MFC, that would work for you.
>
> Look here:http://www.codeproject.com/KB/MFC/CryptoPPCFileMFC.aspx
>
>
>
> > Thank you, Eugene, I've just tried the code, and it works exactly.
> > It's a nice solution.
> > Is there a better one?
> > Maybe someone has made a Unicode version, replacing std::string by
> > std::wstring in the lib-code CryptoPP.
>
> > On Jun 26, 2:15 am, Eugene Zolenko <[email protected]> wrote:
>
> >> That's not CryptoPP problem, but rather broken standard C++ unicode
> >> support.
>
> >> 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, ...);
>
> >> On Linux you will have to convert you std::wstring into UTF8 encoded
> >> std::string first. (Using your favorite UTF8 conversion libraries :)).
>
> >> Note that using UTF8 converted string on windows doesn't seem to work.
>
> >> On Jun 24, 10:10 pm, Kincorn <[email protected]> wrote:
>
> >>> I'm a new user, and Crypto++ is really wonderful and powerful,
> >>> haha ...
>
> >>> When using FileSink with path including non-ascii chars (e.g.
> >>> chinese), I've got the exception:
> >>> "FileSink: error opening file for writing: D:\Project\Crypto\测试
> >>> \privkey.txt"
> >>> But it's well run in ascii environment.
>
> >>> And then, I found out that something's wrong in function wbstowcs_s()
> >>> in STL class fstream as the default local setting is C-Locale. So I
> >>> can call function setlocale(LC_ALL, szCodePage) to resolve it, but
> >>> it's really troubled, isn't it? And the key-problem is, when I use a
> >>> special CodePage, it cann't work in another CodePage environment!
>
> >>> And my project is unicode-based, all the code like "std::string, char
> >>> [], ..." in Crypto++ may result unpredictable issues.
>
> >>> Has CryptoPP got the unicode version? If not, how can I fix the
> >>> problem?
> >>> Thanks for your advice...
>
> >>> Thanks,
> >>> Kincorn
>
> >>> Development environment:
> >>> PC x86
> >>> Windows XP SP2
> >>> Visual Studio 2005- Hide quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the "Crypto++ Users" 
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at 
http://www.cryptopp.com.
-~----------~----~----~----~------~----~------~--~---

Reply via email to