Changeset 53754
- Timestamp:
- 07/21/2022 09:09:56 PM (2 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/formatting.php
r53455 r53754 1585 1585 * @since 5.7.0 Added locale support for `de_AT`. 1586 1586 * @since 6.0.0 Added the `$locale` parameter. 1587 * @since 6.1.0 Added Unicode NFC encoding normalization support. 1587 1588 * 1588 1589 * @param string $string Text that might have accent characters. … … 1598 1599 1599 1600 if ( seems_utf8( $string ) ) { 1601 1602 // Unicode sequence normalization from NFD (Normalization Form Decomposed) 1603 // to NFC (Normalization Form [Pre]Composed), the encoding used in this function. 1604 if ( function_exists( 'normalizer_normalize' ) ) { 1605 if ( ! normalizer_is_normalized( $string, Normalizer::FORM_C ) ) { 1606 $string = normalizer_normalize( $string, Normalizer::FORM_C ); 1607 } 1608 } 1609 1600 1610 $chars = array( 1601 1611 // Decompositions for Latin-1 Supplement. -
trunk/tests/phpunit/tests/formatting/removeAccents.php
r53562 r53754 10 10 public function test_remove_accents_simple() { 11 11 $this->assertSame( 'abcdefghijkl', remove_accents( 'abcdefghijkl' ) ); 12 } 13 14 /** 15 * @ticket 24661 16 * 17 * Tests Unicode sequence normalization from NFD (Normalization Form Decomposed) 18 * to NFC (Normalization Form [Pre]Composed), the encoding used in `remove_accents()`. 19 * 20 * For more information on Unicode normalization, see 21 * https://unicode.org/faq/normalization.html. 22 * 23 * @requires extension intl 24 */ 25 public function test_remove_accents_latin1_supplement_nfd_encoding() { 26 $input = 'ªºÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ'; 27 $output = 'aoAAAAAAAECEEEEIIIIDNOOOOOOUUUUYTHsaaaaaaaeceeeeiiiidnoooooouuuuythy'; 28 29 $this->assertSame( $output, remove_accents( $input ), 'remove_accents replaces Latin-1 Supplement with NFD encoding' ); 12 30 } 13 31
Note: See TracChangeset
for help on using the changeset viewer.