? batax-commaquote.patch
Index: batax.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/batax/batax.module,v
retrieving revision 1.10
diff -u -p -r1.10 batax.module
--- batax.module	6 Nov 2009 12:53:10 -0000	1.10
+++ batax.module	13 Dec 2010 18:17:08 -0000
@@ -264,7 +264,11 @@ function batax_text_field_from_tids($tid
   }
   foreach($tids as $tid){
     $term = taxonomy_get_term($tid);
-    $field_terms[] = check_plain($term->name).':'.$term->tid;
+    // Commas and quotes in tag names are special cases, so encode 'em.
+    if (strpos($term->name, ',') !== FALSE || strpos($term->name, '"') !== FALSE) {
+      $field_terms[] = '"'. str_replace('"', '""', $term->name.':'.$term->tid) .'"';
+    }
+    else $field_terms[] = $term->name.':'.$term->tid;
   }
   return implode(", ",$field_terms);
 }
