Rectangle 27 197

I ended up installing zlib from apt-get and then reinstalling ruby to not use the rvm directory for zlib.

$ sudo apt-get install zlib1g-dev
$ rvm reinstall 1.9.3
$ sudo yum install zlib-devel
$ rvm reinstall 1.9.3

I tagged the question as ubuntu :P

Well, regardless of the OS, @chrisfinne 's advice is still useful (for me at least)!

Worked perfectly for me. Although I had to recompile once more since I was missing libssl-dev too (I needed it because rvm wanted to fetch the ruby sources via HTTPS) :-)

same procedure with rbenv....

Sign up for our newsletter and get our top new questions delivered to your inbox (see an example).

ruby - cannot load such file -- zlib even after using rvm pkg install ...

ruby linux gem rvm
Rectangle 27 296

If you come across this question trying to install Ruby using Ruby Version Manager (RVM) on Ubuntu 10.04 then there are instructions on installing zlib on the rvm web site http://rvm.beginrescueend.com/packages/zlib/

rvm pkg install zlib

(or rvm package install zlib if you get "ERROR: Unrecognized command line argument: 'pkg'" - older versions of rvm used the verb 'package' instead)

rvm remove 1.9.1
rvm install 1.9.1

great, same approach worked for me with a minor variation for 1.9.2: vm package install zlib ; rvm remove 1.9.2-p0 ; rvm install 1.9.2-p0 --with-zlib-dir=$rvm_path/usr

wonderful, i was wondering why rvm wasn't working on debian even with zlib installed via apt

vm package install zib; rvm remove 1.9.2; rvm install 1.9.2 --with-zlib-dir=$rvm_path/usr
pkg

ruby - Ubuntu noob rails install fails on zlib - Stack Overflow

ruby-on-rails ruby gem zlib ubuntu-8.10
Rectangle 27 550

It begs the question, what are the advantages of having it return as an array and not an object?

It raises the question. To "beg a question" means to assume something that remains to be proved (ref). In either case, the advantage might be that the OP is more comfortable traversing arrays than objects, or that some other, already implemented, code requires an array.

@jamesnotjim The default implementation that returns an object could beg the question that objects are better return values than arrays, could it not?

I would add the comment (albeit years later) that there is no possibility of JSON containing anything but data making this a confounding "default" choice.

php - json_decode to array - Stack Overflow

php arrays json
Rectangle 27 296

If you come across this question trying to install Ruby using Ruby Version Manager (RVM) on Ubuntu 10.04 then there are instructions on installing zlib on the rvm web site http://rvm.beginrescueend.com/packages/zlib/

rvm pkg install zlib

(or rvm package install zlib if you get "ERROR: Unrecognized command line argument: 'pkg'" - older versions of rvm used the verb 'package' instead)

rvm remove 1.9.1
rvm install 1.9.1

great, same approach worked for me with a minor variation for 1.9.2: vm package install zlib ; rvm remove 1.9.2-p0 ; rvm install 1.9.2-p0 --with-zlib-dir=$rvm_path/usr

wonderful, i was wondering why rvm wasn't working on debian even with zlib installed via apt

vm package install zib; rvm remove 1.9.2; rvm install 1.9.2 --with-zlib-dir=$rvm_path/usr
pkg

ruby - Ubuntu noob rails install fails on zlib - Stack Overflow

ruby-on-rails ruby gem zlib ubuntu-8.10
Rectangle 27 52

I am using Ubuntu 10.04 (Lucid), i wanted to install ruby 1.9.2 because 1.9.1 is not recommended with Rails. So I downloaded the source for 1.9.2 and unzipped/unarchived it. my source distro is ruby-1.9.2-p0. After I unpacked it, I built zlib as follows:

cd ruby-1.9.2-p0/ext/zlib
ruby extconf.rb
make
sudo make install
sudo gem install rails

that fixed the problem. This is similar to what other people posted above, but not exactly, so I figured I may as well post exactly what I did to get it going.

This is the best resource i found. I installed ruby from source without rvm, and get a problem with zlib. This post help alot. Thank you!

Thank you. Fixes the issue on 1.9.2-p180/Red Hat 4.1.2-46 too.

This worked for Ubnutu 11.04/Ruby 1.9.2-p180. I tried apt-get install zlib1g zlib1g-dev but it didn't work (it's possible that zlib1g-dev was not installed before I compiled Ruby).

ruby - Ubuntu noob rails install fails on zlib - Stack Overflow

ruby-on-rails ruby gem zlib ubuntu-8.10
Rectangle 27 1912

.zip is an archive format using, usually, the Deflate compression method. The .gz gzip format is for single files, also using the Deflate compression method. Often gzip is used in combination with tar to make a compressed archive format, .tar.gz. The zlib library provides Deflate compression and decompression code for use by zip, gzip, png (which uses the zlib wrapper on deflate data), and many other applications.

The ZIP format was developed by Phil Katz as an open format with an open specification, where his implementation, PKZIP, was shareware. It is an archive format that stores files and their directory structure, where each file is individually compressed. The file type is .zip. The files, as well as the directory structure, can optionally be encrypted.

The ZIP format supports several compression methods:

0 - The file is stored (no compression)
1 - The file is Shrunk
2 - The file is Reduced with compression factor 1
3 - The file is Reduced with compression factor 2
4 - The file is Reduced with compression factor 3
5 - The file is Reduced with compression factor 4
6 - The file is Imploded
7 - Reserved for Tokenizing compression algorithm
8 - The file is Deflated
9 - Enhanced Deflating using Deflate64(tm)
10 - PKWARE Data Compression Library Imploding (old IBM TERSE)
11 - Reserved by PKWARE
12 - File is compressed using BZIP2 algorithm
13 - Reserved by PKWARE
14 - LZMA (EFS)
15 - Reserved by PKWARE
16 - Reserved by PKWARE
17 - Reserved by PKWARE
18 - File is compressed using IBM TERSE (new)
19 - IBM LZ77 z Architecture (PFS)
97 - WavPack compressed data
98 - PPMd version I, Rev 1

Methods 1 to 7 are historical and are not in use. Methods 9 through 98 are relatively recent additions, and are in varying, small amounts of use. The only method in truly widespread use in the ZIP format is method 8, Deflate, and to some smaller extent method 0, which is no compression at all. Virtually every .zip file that you will come across in the wild will use exclusively methods 8 and 0, likely just method 8. (Method 8 also has a means to effectively store the data with no compression and relatively little expansion, and Method 0 cannot be streamed whereas Method 8 can be.)

The ISO/IEC 21320-1:2015 standard for file containers is a restricted zip format, such as used in Java archive files (.jar), Office Open XML files (Microsoft Office .docx, .xlsx, .pptx), Office Document Format files (.odt, .ods, .odp), and EPUB files (.epub). That standard limits the compression methods to 0 and 8, as well as other constraints such as no encryption or signatures.

Around 1990, the Info-ZIP group wrote portable, free, open source implementations of zip and unzip utilities, supporting compression with the Deflate format, and decompression of that and the earlier formats. This greatly expanded the use of the .zip format.

In the early 90's, the gzip format was developed as a replacement for the Unix compress utility, derived from the Deflate code in the Info-ZIP utilities. Unix compress was designed to compress a single file or stream, appending a .Z to the file name. compress uses the LZW compression algorithm, which at the time was under patent and its free use was in dispute by the patent holders. Though some specific implementations of Deflate were patented by Phil Katz, the format was not, and so it was possible to write a Deflate implementation that did not infringe on any patents. That implementation has not been so challenged in the last 20+ years. The Unix gzip utility was intended as a drop-in replacement for compress, and in fact is able to decompress compress-compressed data (assuming that you were able to parse that sentence). gzip appends a .gz to the file name. gzip uses the Deflate compressed data format, which compresses quite a bit better than Unix compress, has very fast decompression, and adds a CRC-32 as an integrity check for the data. The header format also permits the storage of more information than the compress format allowed, such as the original file name and the file modification time.

Though compress only compresses a single file, it was common to use the tar utility to create an archive of files, their attributes, and their directory structure into a single .tar file, and to then compress it with compress to make a .tar.Z file. In fact the tar utility had and still has an option to do the compression at the same time, instead of having to pipe the output of tar to compress. This all carried forward to the gzip format, and tar has an option to compress directly to the .tar.gz format. The tar.gz format compresses better than the .zip approach, since the compression of a .tar can take advantage of redundancy across files, especially many small files. .tar.gz is the most common archive format in use on Unix due to its very high portability, but there are more effective compression methods in use as well, so you will often see .tar.bz2 and .tar.xz archives.

Unlike .tar, .zip has a central directory at the end, which provides a list of the contents. That and the separate compression provides random access to the individual entries in a .zip file. A .tar file would have to be decompressed and scanned from start to end in order to build a directory, which is how a .tar file is listed.

Shortly after the introduction of gzip, around the mid-1990's, the same patent dispute called into question the free use of the .gif image format, very widely used on bulletin boards and the World Wide Web (a new thing at the time). So a small group created the PNG losslessly compressed image format, with file type .png, to replace .gif. That format also uses the Deflate format for compression, which is applied after filters on the image data expose more of the redundancy. In order to promote widespread usage of the PNG format, two free code libraries were created. libpng and zlib. libpng handled all of the features of the PNG format, and zlib provided the compression and decompression code for use by libpng, as well as for other applications. zlib was adapted from the gzip code.

All of the mentioned patents have since expired.

The zlib library supports Deflate compression and decompression, and three kinds of wrapping around the deflate streams. Those are: no wrapping at all ("raw" deflate), zlib wrapping, which is used in the PNG format data blocks, and gzip wrapping, to provide gzip routines for the programmer. The main difference between zlib and gzip wrapping is that the zlib wrapping is more compact, six bytes vs. a minimum of 18 bytes for gzip, and the integrity check, Adler-32, runs faster than the CRC-32 that gzip uses. Raw deflate is used by programs that read and write the .zip format, which is another format that wraps around deflate compressed data.

zlib is now in wide use for data transmission and storage. For example, most HTTP transactions by servers and browsers compress and decompress the data using zlib.

Different implementations of deflate can result in different compressed output for the same input data, as evidenced by the existence of selectable compression levels that allow trading off compression effectiveness for CPU time. zlib and PKZIP are not the only implementations of deflate compression and decompression. Both the 7-Zip archiving utility and Google's zopfli library have the ability to use much more CPU time than zlib in order to squeeze out the last few bits possible when using the deflate format, reducing compressed sizes by a few percent as compared to zlib's highest compression level. The pigz utility, a parallel implementation of gzip, includes the option to use zlib (compression levels 1-9) or zopfli (compression level 11), and somewhat mitigates the time impact of using zopfli by splitting the compression of large files over multiple processors and cores.

This post is packed with so much history and information that I feel like some citations need be added incase people try to reference this post as an information source. Though if this information is reflected somewhere with citations like Wikipedia, a link to such similar cited work would be appreciated.

I am the reference, having been part of all of that. This post could be cited in Wikipedia as an original source.

FYI: Mark Adler is an American software engineer, and has been heavily involved in space exploration. He is best known for his work in the field of data compression as the author of the Adler-32 checksum function, and a co-author of the zlib compression library and gzip. He has contributed to Info-ZIP, and has participated in developing the Portable Network Graphics (PNG) image format. Adler was also the Spirit Cruise Mission Manager for the Mars Exploration Rover mission. (wikipedia)

gzip was created to replace Unix compress. zip is not superior to tar + gzip on Unix, for several reasons. (When you see .tar.gz files, that's what they are.) First, tar + gzip compresses better than zip, since the compression of the next file can use history from the previous file (sometimes referred to as a "solid" archive). zip can only compress files individually. Second, tar preserves all of the Unix directory information, whereas zip was not designed to do that. (Later extensions to the zip format with Unix-specific extra blocks tries to remedy this problem.)

You seem to be confusing formats with implementation. The 7-Zip implementation of the deflate format can get something like your quoted 2% to 10% better compression than gzip with the very same deflate format (while taking much more CPU time to do so). The 7z LZMA2 format offers on the order of 40% better compression.

compression - How are zlib, gzip and zip related? What do they have in...

compression zip gzip zlib
Rectangle 27 34

Openssl on mac is compiled without zlib support. Alternative method described in this article works on my Yosemite:

dd if=backup.ab bs=1 skip=24 | python -c "import zlib,sys;sys.stdout.write(zlib.decompress(sys.stdin.read()))" > backup.tar

It skips first 24 bytes of Android header and then uncompresses zlib data.

got it "..make sure you specify the files to include in the proper order by creating a backup file list and passing to tar with the -T option."

macos - Error: 'zlib' is an invalid command - Stack Overflow

macos openssl zlib
Rectangle 27 204

I recommend against using the jQuery code that was accepted as the answer. While it does not insert the string to decode into the page, it does cause things such as scripts and HTML elements to get created. This is way more code than we need. Instead, I suggest using a safer, more optimized function.

var decodeEntities = (function() {
  // this prevents any overhead from creating the object each time
  var element = document.createElement('div');

  function decodeHTMLEntities (str) {
    if(str && typeof str === 'string') {
      // strip script/html tags
      str = str.replace(/<script[^>]*>([\S\s]*?)<\/script>/gmi, '');
      str = str.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gmi, '');
      element.innerHTML = str;
      str = element.textContent;
      element.textContent = '';
    }

    return str;
  }

  return decodeHTMLEntities;
})();

To use this function, just call decodeEntities("") and it will use the same underlying techniques as the jQuery version willbut without jQuery's overhead, and after sanitizing the HTML tags in the input. See Mike Samuel's comment on the accepted answer for how to filter out HTML tags.

This function can be easily used as a jQuery plugin by adding the following line in your project.

jQuery.decodeEntities = decodeEntities;

Can someone tell me what str.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gmi, ''); does?

@PoeHaH It strips out all html tags, both opening and closing.

Note: textContent is not supported in IE8, so if that's still one of your targeted browsers, you have to find another solution. I just wasted an hour trying to figure that out, since we need to decode entities specifically to compensate for another IE8 bug.

@GregCharles I don't know of any good alternatives for IE8 and lower. There's no particularly convenient way to get the text content of a node without textContent.

Careful with the line that takes out HTML tags. You shouldn't be using regex with HTML/XML. Bobince has made this clear for ages.

javascript - HTML Entity Decode - Stack Overflow

javascript jquery html
Rectangle 27 22

I have the same problem in CentOS and fix it by executing the following command:

First, I ensure that zlib and zlib-devel exist (like many suggested above).

yum install zlib zlib-devel

Second, I recompiled and installed the sources of zlib that comes with ruby.

cd /home/myname/installers/ruby-1.8.7-p174/ext/zlib/
ruby extconf.rb --with-zlib-include=/usr/include --with-zlib-lib=/usr/lib
make
make install

That commands seem to fix the problem, then I execute gem update --system and the error with zlib vanished. Then I install rails with gem install rails. Note to mention I had installed gem before, and after recompile and install zlib, I don't recompile neither install gem (actually I don't knew how uninstall it because I don't found a script to do that)

Thanks a lot. That worked for me.

ruby - Ubuntu noob rails install fails on zlib - Stack Overflow

ruby-on-rails ruby gem zlib ubuntu-8.10
Rectangle 27 163

var Title = $('<textarea />').html("Chris&apos; corner").text();
console.log(Title);
$('form').submit(function() {
  var theString = $('#string').val();
  var varTitle = $('<textarea />').html(theString).text();
  $('#output').text(varTitle);
  return false;
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form action="#" method="post">
  <fieldset>
    <label for="string">Enter a html-encoded string to decode</label>
    <input type="text" name="string" id="string" />
  </fieldset>
  <fieldset>
    <input type="submit" value="decode" />
  </fieldset>
</form>

<div id="output"></div>

Cool that works. So just curious, the $('div />') is used to create a <div> element around the varTitle?

@chris and @david - This code creates an empty (detached from DOM) div and sets it's innerHTML and finally retrieved back as normal text. It's not surrounding it with a DIV, but putting it in a div. I putting some emphasis over this since it's crucial to understand how jQuery works.

javascript - HTML Entity Decode - Stack Overflow

javascript jquery html
Rectangle 27 163

var Title = $('<textarea />').html("Chris&apos; corner").text();
console.log(Title);
$('form').submit(function() {
  var theString = $('#string').val();
  var varTitle = $('<textarea />').html(theString).text();
  $('#output').text(varTitle);
  return false;
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form action="#" method="post">
  <fieldset>
    <label for="string">Enter a html-encoded string to decode</label>
    <input type="text" name="string" id="string" />
  </fieldset>
  <fieldset>
    <input type="submit" value="decode" />
  </fieldset>
</form>

<div id="output"></div>

Cool that works. So just curious, the $('div />') is used to create a <div> element around the varTitle?

@chris and @david - This code creates an empty (detached from DOM) div and sets it's innerHTML and finally retrieved back as normal text. It's not surrounding it with a DIV, but putting it in a div. I putting some emphasis over this since it's crucial to understand how jQuery works.

javascript - HTML Entity Decode - Stack Overflow

javascript jquery html
Rectangle 27 18

$ xcode-select --install

seems to have solved the problem for me.

helped me solve an el capitan problem too - but why, what is xcode-select?

xcode-select manages the active developer directory for Xcode and BSD tools. --install opens a user interface dialog to request automatic installation of the command line developer tools.

solved issue on El Capitan. This type of Q&A saves hours for people. Thanks

python - Zlib error when installing Pillow on Mac - Stack Overflow

python macos pillow
Rectangle 27 9

The both other responses were almost right...

On the top off the page is a "Quick fix" follow it's instructions, it will:

ruby - cannot load such file -- zlib even after using rvm pkg install ...

ruby linux gem rvm
Rectangle 27 204

I recommend against using the jQuery code that was accepted as the answer. While it does not insert the string to decode into the page, it does cause things such as scripts and HTML elements to get created. This is way more code than we need. Instead, I suggest using a safer, more optimized function.

var decodeEntities = (function() {
  // this prevents any overhead from creating the object each time
  var element = document.createElement('div');

  function decodeHTMLEntities (str) {
    if(str && typeof str === 'string') {
      // strip script/html tags
      str = str.replace(/<script[^>]*>([\S\s]*?)<\/script>/gmi, '');
      str = str.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gmi, '');
      element.innerHTML = str;
      str = element.textContent;
      element.textContent = '';
    }

    return str;
  }

  return decodeHTMLEntities;
})();

To use this function, just call decodeEntities("") and it will use the same underlying techniques as the jQuery version willbut without jQuery's overhead, and after sanitizing the HTML tags in the input. See Mike Samuel's comment on the accepted answer for how to filter out HTML tags.

This function can be easily used as a jQuery plugin by adding the following line in your project.

jQuery.decodeEntities = decodeEntities;

Can someone tell me what str.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gmi, ''); does?

@PoeHaH It strips out all html tags, both opening and closing.

Note: textContent is not supported in IE8, so if that's still one of your targeted browsers, you have to find another solution. I just wasted an hour trying to figure that out, since we need to decode entities specifically to compensate for another IE8 bug.

@GregCharles I don't know of any good alternatives for IE8 and lower. There's no particularly convenient way to get the text content of a node without textContent.

Careful with the line that takes out HTML tags. You shouldn't be using regex with HTML/XML. Bobince has made this clear for ages.

javascript - HTML Entity Decode - Stack Overflow

javascript jquery html
Rectangle 27 83

Like Robert K said, don't use jQuery.html().text() to decode html entities as it's unsafe because user input should never have access to the DOM. Read about XSS for why this is unsafe.

Instead try the Underscore.js utility-belt library which comes with escape and unescape methods:

Escapes a string for insertion into HTML, replacing &, <, >, ", `, and ' characters.

_.escape('Curly, Larry & Moe');
=> "Curly, Larry &amp; Moe"

The opposite of escape, replaces , , , , and with their unescaped counterparts.

_.unescape('Curly, Larry &amp; Moe');
=> "Curly, Larry & Moe"

To support decoding more characters, just copy the Underscore unescape method and add more characters to the map.

TypeError: _.unescape is not a function

@chovy, use the latest Underscore.js version >= 1.4.2 and you won't get a TypeError.

I like this answer because it doesn't require a DOM, and nowadays who can guarantee access to the DOM API when writing javascript? Unfortunately it only works for the listed entities, and leaves things like untouched.

+1 for using a source-controlled library rather than copying and pasting some random code from the top stack overflow answer. If only the javascript standard library had these kind of low-level functions.

Keep in mind that it does not unencode encoded russian or japanese characters. e.g. -> cannot be done with this

javascript - HTML Entity Decode - Stack Overflow

javascript jquery html
Rectangle 27 93

To decompress a gzip format file with zlib, call inflateInit2 with the windowBits parameter as 16+MAX_WBITS, like this:

inflateInit2(&stream, 16+MAX_WBITS);

If you don't do this, zlib will complain about a bad stream format. By default, zlib creates streams with a zlib header, and on inflate does not recognise the different gzip header unless you tell it so. Although this is documented starting in version 1.2.1 of the zlib.h header file, it is not in the zlib manual. From the header file:

windowBits can also be greater than 15 for optional gzip decoding. Add 32 to windowBits to enable zlib and gzip decoding with automatic header detection, or add 16 to decode only the gzip format (the zlib format will return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a crc32 instead of an adler32.

zlib.decompress(data, 15 + 32)

Thanks, this was highly frustrating until I found this post.

How can I decompress a gzip stream with zlib? - Stack Overflow

gzip zlib inflate
Rectangle 27 17

Pako is a full and modern Zlib port.

Here is a very simple example and you can work from there.

Get pako.js and you can decompress byteArray like so:

<html>
<head>
  <title>Gunzipping binary gzipped string</title>
  <script type="text/javascript" src="pako.js"></script>
  <script type="text/javascript">

    // Get datastream as Array, for example:
    var charData    = [31,139,8,0,0,0,0,0,0,3,5,193,219,13,0,16,16,4,192,86,214,151,102,52,33,110,35,66,108,226,60,218,55,147,164,238,24,173,19,143,241,18,85,27,58,203,57,46,29,25,198,34,163,193,247,106,179,134,15,50,167,173,148,48,0,0,0];

    // Turn number array into byte-array
    var binData     = new Uint8Array(charData);

    // Pako magic
    var data        = pako.inflate(binData);

    // Convert gunzipped byteArray back to ascii string:
    var strData     = String.fromCharCode.apply(null, new Uint16Array(data));

    // Output to console
    console.log(strData);

  </script>
</head>
<body>
    Open up the developer console.
</body>
</html>

Alternatively you can base64 encode the array before you send it over as the Array takes up a lot of overhead when sending as JSON or XML. Decode likewise:

// Get some base64 encoded binary data from the server. Imagine we got this:
var b64Data     = 'H4sIAAAAAAAAAwXB2w0AEBAEwFbWl2Y0IW4jQmziPNo3k6TuGK0Tj/ESVRs6yzkuHRnGIqPB92qzhg8yp62UMAAAAA==';

// Decode base64 (convert ascii to binary)
var strData     = atob(b64Data);

// Convert binary string to character-number array
var charData    = strData.split('').map(function(x){return x.charCodeAt(0);});

// Turn number array into byte-array
var binData     = new Uint8Array(charData);

// Pako magic
var data        = pako.inflate(binData);

// Convert gunzipped byteArray back to ascii string:
var strData     = String.fromCharCode.apply(null, new Uint16Array(data));

// Output to console
console.log(strData);
pako

The html example probably will not work as it is, because pako is not defined. The API has changed maybe, it uses require now.

String.fromCharCode.apply(null, new Uint16Array(data))

Decompress gzip and zlib string in javascript - Stack Overflow

javascript gzip zlib decompression tmx
Rectangle 27 69

Accurate but possibly a bit telegraphic so I've added a more detailed explanation.

Am I the only one who thinks Python has this the wrong way around? When I turn a python string into it's binary utf-8 representation, surely that should be termed "encoding", and not the other way around?

@rogueprocess Python has it the opposite way from what you're describing: u"\u2603".encode('utf8') returns a string of bytes in the utf-8 representation, and "\xe2\x98\x83".decode('utf8') returns a Unicode string.

That is a fantastic presentation, and the clearest explanation I've seen so far. Thank you for posting the link.

python string encode / decode - Stack Overflow

python python-2.7
Rectangle 27 12

aptitude install zlib1g-dev

i actually had to do this before being able to compile the zlib that came with ruby source

ruby - Ubuntu noob rails install fails on zlib - Stack Overflow

ruby-on-rails ruby gem zlib ubuntu-8.10
Rectangle 27 96

import base64
coded_string = '''Q5YACgA...'''
base64.b64decode(coded_string)

worked for me. At the risk of pasting an offensively-long result, I got:

>>> base64.b64decode(coded_string)
2: 'C\x96\x00\n\x00\x00\x00\x00C\x96\x00\x1b\x00\x00\x00\x00C\x96\x00-\x00\x00\x00\x00C\x96\x00?\x00\x00\x00\x00C\x96\x07M\x00\x00\x00\x00C\x96\x07_\x00\x00\x00\x00C\x96\x07p\x00\x00\x00\x00C\x96\x07\x82\x00\x00\x00\x00C\x96\x07\x94\x00\x00\x00\x00C\x96\x07\xa6Cq\xf0\x7fC\x96\x07\xb8DJ\x81\xc7C\x96\x07\xcaD\xa5\x9dtC\x96\x07\xdcD\xb6\x97\x11C\x96\x07\xeeD\x8b\x8flC\x96\x07\xffD\x03\xd4\xaaC\x96\x08\x11B\x05&\xdcC\x96\x08#\x00\x00\x00\x00C\x96\x085C\x0c\xc9\xb7C\x96\x08GCy\xc0\xebC\x96\x08YC\x81\xa4xC\x96\x08kC\x0f@\x9bC\x96\x08}\x00\x00\x00\x00C\x96\x08\x8e\x00\x00\x00\x00C\x96\x08\xa0\x00\x00\x00\x00C\x96\x08\xb2\x00\x00\x00\x00C\x96\x86\xf9\x00\x00\x00\x00C\x96\x87\x0b\x00\x00\x00\x00C\x96\x87\x1d\x00\x00\x00\x00C\x96\x87/\x00\x00\x00\x00C\x96\x87AA\x0b\xe7PC\x96\x87SCI\xf5gC\x96\x87eC\xd4J\xeaC\x96\x87wD\r\x17EC\x96\x87\x89D\x00F6C\x96\x87\x9bC\x9cg\xdeC\x96\x87\xadB\xd56\x0cC\x96\x87\xbf\x00\x00\x00\x00C\x96\x87\xd1\x00\x00\x00\x00C\x96\x87\xe3\x00\x00\x00\x00C\x96\x87\xf5\x00\x00\x00\x00C\x9cY}\x00\x00\x00\x00C\x9cY\x90\x00\x00\x00\x00C\x9cY\xa4\x00\x00\x00\x00C\x9cY\xb7\x00\x00\x00\x00C\x9cY\xcbC\x1f\xbd\xa3C\x9cY\xdeCCz{C\x9cY\xf1CD\x02\xa7C\x9cZ\x05C+\x9d\x97C\x9cZ\x18C\x03R\xe3C\x9cZ,\x00\x00\x00\x00C\x9cZ?
[stuff omitted as it exceeded SO's body length limits]
\xbb\x00\x00\x00\x00D\xc5!7\x00\x00\x00\x00D\xc5!\xb2\x00\x00\x00\x00D\xc7\x14x\x00\x00\x00\x00D\xc7\x14\xf6\x00\x00\x00\x00D\xc7\x15t\x00\x00\x00\x00D\xc7\x15\xf2\x00\x00\x00\x00D\xc7\x16pC5\x9f\xf9D\xc7\x16\xeeC[\xb5\xf5D\xc7\x17lCG\x1b;D\xc7\x17\xeaB\xe3\x0b\xa6D\xc7\x18h\x00\x00\x00\x00D\xc7\x18\xe6\x00\x00\x00\x00D\xc7\x19d\x00\x00\x00\x00D\xc7\x19\xe2\x00\x00\x00\x00D\xc7\xfe\xb4\x00\x00\x00\x00D\xc7\xff3\x00\x00\x00\x00D\xc7\xff\xb2\x00\x00\x00\x00D\xc8\x001\x00\x00\x00\x00'

I have exactlly the same process as you did, but what are the results ?

This is pretty old but I think their issue was the above is it doesn't print anything. I assume print base64.b64decode(coded_string) was what they were looking for. Thanks for the simple example it helped me!

Python base64 data decode - Stack Overflow

python base64 decode