Download & Extend

terms containing commas and quotes are not handled properly

Project:Big Autocomplete TAXonomy
Version:6.x-1.7
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

When displaying tags, the taxonomy module takes any terms it encounters that contain commas or quotes and wraps them in quotes.

<?php
function taxonomy_implode_tags($tags, $vid = NULL) {
 
$typed_tags = array();
  foreach (
$tags as $tag) {
   
// Extract terms belonging to the vocabulary in question.
   
if (is_null($vid) || $tag->vid == $vid) {

     
// Commas and quotes in tag names are special cases, so encode 'em.
     
if (strpos($tag->name, ',') !== FALSE || strpos($tag->name, '"') !== FALSE) {
       
$tag->name = '"'. str_replace('"', '""', $tag->name) .'"';
      }

     
$typed_tags[] = $tag->name;
    }
  }
  return
implode(', ', $typed_tags);
}
?>

The Batax module should do something similar, but it currently does not. I stole some of the above code from Taxonomy to create the following patch.
AttachmentSize
batax-commaquote.patch881 bytes

Comments

#1

I should point out that a reason this is important is so that when saving a node, a taxonomy term named Term, text doesn't become the 2 terms Term and text.

nobody click here