How to get rid of the '-' sign before sub taxonomy term? when I choose a taxonomy term with a parent, it shows -termName instead of termName, to indicate it is a sub-category. I checked the database, it only stores the termName, which means that somewhere we can rewrite the output to show just termName.

How can I achieve this?
In Drupal 6, the function that outputs the list of taxonomy terms is _taxonomy_term_select(), which contains the following code.

  if ($tree) {
    foreach ($tree as $term) {
      if (!in_array($term-&gt;tid, $exclude)) {
        $choice = new stdClass();
        $choice-&gt;option = array($term-&gt;tid =&gt; str_repeat('-', $term-&gt;depth) . $term-&gt;name);
        $options[] = $choice;
      }
    }
  }

  return array(
    '#type' =&gt; 'select',
    '#title' =&gt; $title,
    '#default_value' =&gt; $value,
    '#options' =&gt; $options,
    '#description' =&gt; $description,
    '#multiple' =&gt; $multiple,
    '#size' =&gt; $multiple ? min(9, count($options)) : 0,
    '#weight' =&gt; -15,
    '#theme' =&gt; 'taxonomy_term_select',
  );


Since it uses theme_taxonomy_term_select(), overriding that theme function is possible to remove those hyphens added at the beginning of the term name.

In Drupal 7, that code is contained in taxonomy_allowed_values().

  $options = array();
  foreach ($field['settings']['allowed_values'] as $tree) {
    if ($vocabulary = taxonomy_vocabulary_machine_name_load($tree['vocabulary'])) {
      if ($terms = taxonomy_get_tree($vocabulary-&gt;vid, $tree['parent'])) {
        foreach ($terms as $term) {
          $options[$term-&gt;tid] = str_repeat('-', $term-&gt;depth) . $term-&gt;name;
        }
      }
    }
  }


Unfortunately, the function calling it (options_field_widget_form()) uses a theme function used for every form element (including the ones not associated with taxonomy terms), for example theme_select().  

  switch ($type) {
    case 'select':
      $element += array(
        '#type' =&gt; 'select',
        '#default_value' =&gt; $default_value,

        // Do not display a 'multiple' select box if there is only one option.
        '#multiple' =&gt; $multiple &amp;&amp; count($options) &gt; 1,
        '#options' =&gt; $options,
      );
      break;

    // …

  }   


Fortunately, options_field_widget_form() uses some custom properties that allows to check if the select form element is being output for an entity. In fact, it uses the following code.

$entity_type = $element['#entity_type'];
$entity = $element['#entity'];


This is true also in the case the used form element is checkboxes, radios, or checkbox.
If $variables['element']['#entity_type'] passed to the theme function for the select form element is set, and it is equal to the entity type for the taxonomy terms, then the theme function can assume it is outputting the select element for a taxonomy term, and remove the hyphens at the beginning of the term name.