ipython/ipython — pull request #2048 by minrk (2012-06-28 02:28:43+00:00)
Title: move _encode_binary to jsonutil.encode_images

And fix identification of PNG/JPEG data, which could be double-encoded when using a JSON library that decodes to str instead of unicode (simplejson 2.6, for instance).

The function is also moved to jsonutil.

Changes are tested.

This is critical for 0.13, because the parallel magics cannot republish images without it, depending on whether simplejson is present.