简体   繁体   中英

Problems decompressing gzip

I'm trying to use a gzip c++ library to decompress some text that i compressed using this website that had a tool to do it, but when i try to decompress it in my project it says that its not compressed and fails to decompress. Am i just misunderstanding these compression formats because the names are the same or is this some other issue that i'm not aware of?

    //'test message' compressed using the website
    std::string test_string = R"(eJwrSS0uUchNLS5OTE8FAB8fBMY=)";

    //returns false
    bool is_compressed = gzip::is_compressed(test_string.data(), test_string.size());

    //crashes
    std::string decompressed = gzip::decompress(test_string.data(), test_string.size());

Website outputs a Base64 encoded string as ASCII, instead of the byte array. I need to decode the Base64 encoding before trying to decompress.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM