diff --git a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php index bd0dbb2c8..a1ef2cd9e 100644 --- a/lib/Cake/Test/Case/View/Helper/FormHelperTest.php +++ b/lib/Cake/Test/Case/View/Helper/FormHelperTest.php @@ -3902,6 +3902,25 @@ class FormHelperTest extends CakeTestCase { '/fieldset' ); $this->assertTags($result, $expected); + + $result = $this->Form->radio( + 'Model.multibyte', + array('男性' => '男性') + ); + $expected = array( + 'input' => array( + 'type' => 'hidden', 'name' => 'data[Model][multibyte]', + 'id' => 'ModelMultibyte_', 'value' => '', + ), + array('input' => array( + 'type' => 'radio', 'name' => 'data[Model][multibyte]', + 'id' => 'ModelMultibyte男性', 'value' => '男性') + ), + array('label' => array('for' => 'ModelMultibyte男性')), + '男性', + '/label', + ); + $this->assertTags($result, $expected); } /** diff --git a/lib/Cake/Utility/Inflector.php b/lib/Cake/Utility/Inflector.php index 594556b60..426334fa5 100644 --- a/lib/Cake/Utility/Inflector.php +++ b/lib/Cake/Utility/Inflector.php @@ -495,7 +495,12 @@ class Inflector { */ public static function humanize($lowerCaseAndUnderscoredWord) { if (!($result = self::_cache(__FUNCTION__, $lowerCaseAndUnderscoredWord))) { - $result = ucwords(str_replace('_', ' ', $lowerCaseAndUnderscoredWord)); + $result = str_replace('_', ' ', $lowerCaseAndUnderscoredWord); + if (function_exists('mb_convert_case') && Multibyte::checkMultibyte($result)) { + $result = mb_convert_case($result, MB_CASE_TITLE, Configure::read('App.encoding')); + } else { + $result = ucwords($result); + } self::_cache(__FUNCTION__, $lowerCaseAndUnderscoredWord, $result); } return $result;