Index: includes/form.inc
===================================================================
--- includes/form.inc
+++ includes/form.inc
@@ -2537,7 +2537,7 @@
       $batch['error_message'] = $t('Please continue to <a href="@error_url">the error page</a>', array('@error_url' => url($url, array('query' => array('id' => $batch['id'], 'op' => 'finished')))));
 
       // Actually store the batch data and the token generated form the batch id.
-      db_query("UPDATE {batch} SET token = '%s', batch = '%s' WHERE bid = %d", drupal_get_token($batch['id']), serialize($batch), $batch['id']);
+      db_query("UPDATE {batch} SET token = '%s', batch = '%s' WHERE bid = %d", drupal_get_token($batch['id']), base64_encode(gzcompress(serialize($batch))), $batch['id']);
 
       drupal_goto($batch['url'], 'op=start&id='. $batch['id']);
     }
Index: includes/batch.inc
===================================================================
--- includes/batch.inc
+++ includes/batch.inc
@@ -13,7 +13,7 @@
 
   // Retrieve the current state of batch from db.
   if (isset($_REQUEST['id']) && $data = db_result(db_query("SELECT batch FROM {batch} WHERE bid = %d AND token = '%s'", $_REQUEST['id'], drupal_get_token($_REQUEST['id'])))) {
-    $batch = unserialize($data);
+    $batch = unserialize(gzuncompress(base64_decode($data)));
   }
   else {
     return FALSE;
@@ -350,6 +350,6 @@
  */
 function _batch_shutdown() {
   if ($batch = batch_get()) {
-    db_query("UPDATE {batch} SET batch = '%s' WHERE bid = %d", serialize($batch), $batch['id']);
+    db_query("UPDATE {batch} SET batch = '%s' WHERE bid = %d", base64_encode(gzcompress(serialize($batch))), $batch['id']);
   }
 }
