The downside is the output has to be either encoded as UTF8 or ISO-8859-1.
I’ve tried to use base64_encode(gzdeflate($string, 9)), but the result ends up being more than the original string.
Can anyone think of a way to do this?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Compressed data is basically binary – it has no character set, it’s just a sequence of bytes. base64 basically increases the size of the input by a factor of about 1.33, so unless the string compressed to less than .66 or so of original size, you’re going to lose out.
The bigger question is why would you need to re-encode the compressed data? Is it to display it as “plain text” instead of the random ‘garbage’ it would be if you output the raw bytes?