From 88ce83b68c9069c7bdf9e8cb3603d51f23868698 Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 31 Aug 2022 17:05:31 +0200 Subject: [PATCH] zipios: unicode handling in ZipOutputStream --- src/zipios++/zipoutputstream.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/zipios++/zipoutputstream.cpp b/src/zipios++/zipoutputstream.cpp index d8104395ba..4c40469955 100644 --- a/src/zipios++/zipoutputstream.cpp +++ b/src/zipios++/zipoutputstream.cpp @@ -5,6 +5,9 @@ #include "zipoutputstreambuf.h" #include "zipoutputstream.h" +#if defined(_WIN32) && defined(ZIPIOS_UTF8) +#include +#endif using std::ostream; @@ -25,7 +28,12 @@ ZipOutputStream::ZipOutputStream( const std::string &filename ) : std::ostream( nullptr ), ofs( nullptr ) { +#if defined(_WIN32) && defined(ZIPIOS_UTF8) + std::wstring wsfilename = Base::FileInfo(filename).toStdWString(); + ofs = new std::ofstream( wsfilename.c_str(), std::ios::out | std::ios::binary ) ; +#else ofs = new std::ofstream( filename.c_str(), std::ios::out | std::ios::binary ) ; +#endif ozf = new ZipOutputStreambuf( ofs->rdbuf() ) ; this->init( ozf ) ; }