| 97 | |
| 98 | /** |
| 99 | * @ticket 24661 |
| 100 | */ |
| 101 | public function test_remove_accents_combining_marks() { |
| 102 | // Creates a string with all the combining marks. |
| 103 | $code_points = array_merge( |
| 104 | range( 0x0300, 0x036F ), // Combining Diacritical Marks |
| 105 | range( 0x1DC0, 0x1DFF ), // Combining Diacritical Marks Supplement |
| 106 | range( 0x20D0, 0x20FF ), // Combining Diacritical Marks for Symbols |
| 107 | range( 0xFE20, 0xFE2F ) // Combining Half Marks |
| 108 | ); |
| 109 | $combining_marks = ''; |
| 110 | foreach ( $code_points as $code_point ) |
| 111 | if ( $code_point <= 0x07ff ) |
| 112 | $combining_marks .= chr( 0xc0 | ( $code_point >> 6 ) ) . chr( 0x80 | ( $code_point & 0x003f ) ); |
| 113 | else |
| 114 | $combining_marks .= chr( 0xe0 | ( $code_point >> 12 ) ) . chr( 0x80 | ( ( $code_point >> 6 ) & 0x003f ) ) . chr( 0x80 | ( $code_point & 0x003f ) ); |
| 115 | // Performs the test: all the characters should be removed. |
| 116 | $this->assertEquals( '', remove_accents( $combining_marks ) ); |
| 117 | } |
| 118 | |