diff --git a/includes/form.inc b/includes/form.inc
index 9018931eff222e8efe7665b778d2e50e0efd5e4a..4f907dd8fc622593b61b88c9fe94728b04925c47 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -2658,6 +2658,9 @@ function theme_fieldset($variables) {
 /**
  * Returns HTML for a radio button form element.
  *
+ * Note: The input "name" attribute needs to be sanitized before output, which
+ *       is currently done by passing all attributes to drupal_attributes().
+ *
  * @param $variables
  *   An associative array containing:
  *   - element: An associative array containing the properties of the element.
@@ -2671,7 +2674,7 @@ function theme_radio($variables) {
   $element['#attributes']['type'] = 'radio';
   element_set_attributes($element, array('id', 'name', '#return_value' => 'value'));
 
-  if (isset($element['#return_value']) && check_plain($element['#value']) == $element['#return_value']) {
+  if (isset($element['#return_value']) && $element['#value'] !== FALSE && $element['#value'] == $element['#return_value']) {
     $element['#attributes']['checked'] = 'checked';
   }
   _form_set_class($element, array('form-radio'));
@@ -2890,7 +2893,9 @@ function form_process_radios($element) {
       $element[$key] += array(
         '#type' => 'radio',
         '#title' => $choice,
-        '#return_value' => check_plain($key),
+        // The key is sanitized in drupal_attributes() during output from the
+        // theme function.
+        '#return_value' => $key,
         '#default_value' => isset($element['#default_value']) ? $element['#default_value'] : NULL,
         '#attributes' => $element['#attributes'],
         '#parents' => $element['#parents'],
diff --git a/modules/simpletest/tests/form.test b/modules/simpletest/tests/form.test
index b2b822361c24e39d68dfa9b382598b201dad887d..a73ac16c254316fa6c31d4e0a514f5654263a037 100644
--- a/modules/simpletest/tests/form.test
+++ b/modules/simpletest/tests/form.test
@@ -396,7 +396,7 @@ class FormElementTestCase extends DrupalWebTestCase {
     // Verify that all options appear in their defined order.
     foreach (array('checkbox', 'radio') as $type) {
       $elements = $this->xpath('//input[@type=:type]', array(':type' => $type));
-      $expected_values = array('0', 'foo', '1', 'bar');
+      $expected_values = array('0', 'foo', '1', 'bar', '>');
       foreach ($elements as $element) {
         $expected = array_shift($expected_values);
         $this->assertIdentical((string) $element['value'], $expected);
@@ -410,7 +410,7 @@ class FormElementTestCase extends DrupalWebTestCase {
     // #weight into account.
     foreach (array('checkbox', 'radio') as $type) {
       $elements = $this->xpath('//input[@type=:type]', array(':type' => $type));
-      $expected_values = array('0', 'foo', 'bar', '1');
+      $expected_values = array('0', 'foo', 'bar', '>', '1');
       foreach ($elements as $element) {
         $expected = array_shift($expected_values);
         $this->assertIdentical((string) $element['value'], $expected);
diff --git a/modules/simpletest/tests/form_test.module b/modules/simpletest/tests/form_test.module
index fadd2aa9ab6b04bf090f7983202362d5bbe72ba0..f908c212fa441f5cfd08271ae5c77812bf98e090 100644
--- a/modules/simpletest/tests/form_test.module
+++ b/modules/simpletest/tests/form_test.module
@@ -355,7 +355,7 @@ function form_test_limit_validation_errors_form($form, &$form_state) {
     '#type' => 'textfield',
     '#element_validate' => array('form_test_limit_validation_errors_element_validate_test'),
   );
-  
+
   $form['test_substring'] = array(
     '#tree' => TRUE,
   );
@@ -369,7 +369,7 @@ function form_test_limit_validation_errors_form($form, &$form_state) {
     '#type' => 'textfield',
     '#element_validate' => array('form_test_limit_validation_errors_element_validate_test'),
   );
-  
+
   $form['actions']['partial'] = array(
     '#type' => 'submit',
     '#limit_validation_errors' => array(array('test')),
@@ -997,6 +997,7 @@ function form_test_checkboxes_radios($form, &$form_state, $customize = FALSE) {
       'foo' => 'Foo',
       1 => 'One',
       'bar' => 'Bar',
+      '>' => 'Special Char',
     ),
   );
   if ($customize) {
@@ -1020,6 +1021,7 @@ function form_test_checkboxes_radios($form, &$form_state, $customize = FALSE) {
       'foo' => 'Foo',
       1 => 'One',
       'bar' => 'Bar',
+      '>' => 'Special Char',
     ),
   );
   if ($customize) {