Hello,
I am trying to compress in EU4 client, send the data and decompress on the server side which has the same ZLib version but with boost.
It does not work so I went and look at the data sent :
While my C++ server comply with the ZLib RFC (RFC 1950 - ZLIB Compressed Data Format Specification version 3.3) meaning that the header should look like 78 9c the UE4 does not. My problem is the client starts with C1 83 and has a lot of bytes after that.
The data on the client side is cast into ANSI to be sure that it is compatible.
Why is that ? Does UE4 adds an overhead for more information ? Should I include ZLib myself and use it directly ?
Compression on UE4 :
void MessageManager::compressString(const FString &json, TArray<uint8> &compressedData)
{
// Compress File
TArray<TCHAR> t = json.GetCharArray();
ANSICHAR* a = TCHAR_TO_ANSI(t.GetData());
TArray<uint8> dataArray((uint8*)a, t.Num());
FArchiveSaveCompressedProxy compressor =
FArchiveSaveCompressedProxy(compressedData, ECompressionFlags::COMPRESS_ZLIB);
compressor << dataArray;
compressor.Flush();
compressor.FlushCache();
}