Index: mediafield_display.module
===================================================================
--- mediafield_display.module	(revision 649)
+++ mediafield_display.module	(working copy)
@@ -40,6 +40,51 @@
 }
 
 /**
+ * Parse an array into a valid urlencoded query string.
+ *
+ * This function is a work-around for a drupal_urlencode issue in core. 
+ * See http://drupal.org/node/158687 for details.  This function was
+ * originally taken from http://drupal.org/node/162379#comment-281640
+ * and then edited to work with Mediafield Display.
+ *
+ * @param $query
+ *   The array to be processed e.g. $_GET.
+ * @param $exclude
+ *   The array filled with keys to be excluded. Use parent[child] to exclude
+ *   nested items.
+ * @param $parent
+ *   Should not be passed, only used in recursive calls.
+ * @return
+ *   urlencoded string which can be appended to/as the URL query string.
+ */
+function mediafield_display_query_string_encode($query, $exclude = array(),
+                                                $parent = '') {
+  $params = array();
+
+  foreach ($query as $key => $value) {
+    $key = urlencode($key);
+    if ($parent) {
+      $key = $parent .'['. $key .']';
+    }
+
+    if (in_array($key, $exclude)) {
+      continue;
+    }
+
+    if (is_array($value)) {
+      $params[] = mediafield_display_query_string_encode($value, $exclude,
+                                                         $key);
+    }
+    else {
+      $params[] = $key .'='. urlencode($value);
+    }
+  }
+
+  return implode('&', $params);
+}
+
+
+/**
  * Theme a 1pixelout audio file.
  */
 function theme_mediafield_display_1pixelout($file, $item, $field) {
@@ -77,7 +122,9 @@
   $options = array();
   $options['song_url'] = check_url($base_url .'/'. $file['filepath']);
   $options['song_title'] = check_plain($file['description']);
-  $url = $base_url .'/'. drupal_get_path('module', 'mediafield_display') .'/players/button.swf?'. drupal_query_string_encode($options);
+  $url = $base_url . '/' . drupal_get_path('module', 'mediafield_display') .
+         '/players/button.swf?' .
+         mediafield_display_query_string_encode($options);
 
 $output = <<<EOT
 <object type="application/x-shockwave-flash" data="$url" width="17" height="17">';
@@ -88,4 +135,4 @@
 EOT;
 
   return $output;
-}
\ No newline at end of file
+}
