Windows file name to std::string ?

Hmmm, i’m starting to be afraid of something.

I’ve printed the three available translation of FString into std:string:

threeEncodings_src.jpg

And only the first one is correct:

threeEncodings.jpg

The UE4 encoding doc says FStrings are UTF16, which gives sense to the above result: the constructor FString will read UTF8 and ANSI as UTF16, hence the wrong displays.

Now, Windows uses UTF16, so the file name should be encoded in UTF16, so i think the TCHAR_TO_WCHAR macro should be used.

But the AddFile function in the library i use (which leads to the AddEncrpytedFile herebelow) takes only std:string (so ansi or utf8) as an input and use it in std::ifstream::open():

AddFile.jpg

But it looks that std::ifstream::open() only works with *char or &string:
http://www.cplusplus.com/reference/fstream/ifstream/open/

But to work with UTF16 i would need a function capable of working with std::wstring, which is not the case here.

So i’m afraid that ZipLib can’t work with UTF16 and is simply not compatible with Windows.

I hope it’s not that and i don’t have to go hunting another zip library that i can embed in my code.
Finding this one was nightmarish enough !

Anyone can see a flaw in my reasoning ?
I really hope so :slight_smile:

Thanks
Cedric