diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module
index 7fdb8a2..f8afbb2 100644
--- a/core/modules/taxonomy/taxonomy.module
+++ b/core/modules/taxonomy/taxonomy.module
@@ -1344,6 +1344,8 @@ function taxonomy_field_formatter_prepare_view($entity_type, $entities, $field,
         // Rekey the items array.
         $items[$id] = array_values($items[$id]);
       }
+      // Sort the terms according to taxonomy weight, then name.
+      usort($items[$id], 'taxonomy_term_prepare_view_usort_callback');
     }
   }
 }
@@ -1370,6 +1372,9 @@ function taxonomy_field_widget_form(&$form, &$form_state, $field, $instance, $la
     $tags[$item['tid']] = isset($item['taxonomy_term']) ? $item['taxonomy_term'] : taxonomy_term_load($item['tid']);
   }
 
+  // Sort the terms according to taxonomy weight, then name.
+  usort($tags, 'taxonomy_term_usort_callback');
+
   $element += array(
     '#type' => 'textfield',
     '#default_value' => taxonomy_implode_tags($tags),
@@ -1508,6 +1513,44 @@ function taxonomy_rdf_mapping() {
 }
 
 /**
+ * Sort an array of terms for taxonomy_field_formatter_prepare_view().
+ *
+ * @param $a
+ *   An array containing a taxonomy term object.
+ * @param $b
+ *   An array containing a taxonomy term object.
+ *
+ * @return
+ *   An integer less than, equal to, or greater than zero if the first argument
+ *   is considered to be respectively less than, equal to, or greater than the
+ *   second.
+ */
+function taxonomy_term_prepare_view_usort_callback($a, $b) {
+  return taxonomy_term_usort_callback($a['taxonomy_term'], $b['taxonomy_term']);
+}
+
+/**
+ * Sorts an array of taxonomy term objects.
+ *
+ * @param $a
+ *   A taxonomy term object.
+ * @param $b
+ *   A taxonomy term object.
+ *
+ * @return
+ *   An integer less than, equal to, or greater than zero if the first argument
+ *   is considered to be respectively less than, equal to, or greater than the
+ *   second.
+ */
+function taxonomy_term_usort_callback($a, $b) {
+  if (isset($a->weight) && isset($b->weight) && !($a->weight == $b->weight)) {
+    return ($a->weight < $b->weight) ? -1 : 1;
+  }
+  // The terms were the same weight, so sort alphabetically.
+  return strnatcmp($a->name, $b->name);
+}
+
+/**
  * @defgroup taxonomy_index Taxonomy indexing
  * @{
  * Functions to maintain taxonomy indexing.
