| 1 | Index: wp-testcase/test_includes_formatting.php
|
|---|
| 2 | ===================================================================
|
|---|
| 3 | --- wp-testcase/test_includes_formatting.php (revision 444)
|
|---|
| 4 | +++ wp-testcase/test_includes_formatting.php (working copy)
|
|---|
| 5 | @@ -1164,4 +1164,43 @@
|
|---|
| 6 | }
|
|---|
| 7 | }
|
|---|
| 8 |
|
|---|
| 9 | +class TestRemoveAccents extends WPTestCase {
|
|---|
| 10 | + public function test_remove_accents_simple() {
|
|---|
| 11 | + $this->assertEquals( 'abcdefghijkl', remove_accents( 'abcdefghijkl' ) );
|
|---|
| 12 | + }
|
|---|
| 13 | +
|
|---|
| 14 | + public function test_remove_accents_latin1_supplement() {
|
|---|
| 15 | + $input = 'ªºÃÃÃÃÃÃ
|
|---|
| 16 | ÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃà áâãäåæçèéêëìÃîïðñòóôõöøùúûüýþÿ';
|
|---|
| 17 | + $output = 'aoAAAAAAAECEEEEIIIIDNOOOOOOUUUUYTHsaaaaaaaeceeeeiiiidnoooooouuuuythy';
|
|---|
| 18 | +
|
|---|
| 19 | + $this->assertEquals( $output, remove_accents( $input ), 'remove_accents replaces Latin-1 Supplement' );
|
|---|
| 20 | + }
|
|---|
| 21 | +
|
|---|
| 22 | + public function test_remove_accents_latin_extended_a() {
|
|---|
| 23 | + $input = 'ÄÄÄÄÄÄ
|
|---|
| 24 | ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Ä¡Ä¢Ä£Ä¤Ä¥Ä¦Ä§Ä¨Ä©ÄªÄ«Ä¬ÄĮįİıIJijĴĵĶķĸĹĺĻļĽľĿÅÅÅÅÅÅ
|
|---|
| 25 | ÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅÅŠšŢţŤťŦŧŨũŪūŬÅŮůŰűŲųŴŵŶŷŸŹźŻżŽžſ';
|
|---|
| 26 | + $output = 'AaAaAaCcCcCcCcDdDdEeEeEeEeEeGgGgGgGgHhHhIiIiIiIiIiIJijJjKkkLlLlLlLlLlNnNnNnNnNOoOoOoOEoeRrRrRrSsSsSsSsTtTtTtUuUuUuUuUuUuWwYyYZzZzZzs';
|
|---|
| 27 | +
|
|---|
| 28 | + $this->assertEquals( $output, remove_accents( $input ), 'remove_accents replaces Latin Extended A' );
|
|---|
| 29 | + }
|
|---|
| 30 | +
|
|---|
| 31 | + public function test_remove_accents_latin_extended_b() {
|
|---|
| 32 | + $this->assertEquals( 'SsTt', remove_accents( 'ÈÈÈÈ' ), 'remove_accents replaces Latin Extended B' );
|
|---|
| 33 | + }
|
|---|
| 34 | +
|
|---|
| 35 | + public function test_remove_accents_euro_pound_signs() {
|
|---|
| 36 | + $this->assertEquals( 'E', remove_accents( 'â¬' ), 'remove_accents replaces euro sign' );
|
|---|
| 37 | + $this->assertEquals( '', remove_accents( '£' ), 'remove_accents replaces pound sign' );
|
|---|
| 38 | + }
|
|---|
| 39 | +
|
|---|
| 40 | + public function test_remove_accents_iso8859() {
|
|---|
| 41 | + // File is Latin1 encoded
|
|---|
| 42 | + $file = DIR_TESTDATA . DIRECTORY_SEPARATOR . 'formatting' . DIRECTORY_SEPARATOR . 'remove_accents.01.input.txt';
|
|---|
| 43 | + $input = file_get_contents( $file );
|
|---|
| 44 | + $input = trim( $input );
|
|---|
| 45 | + $output = "EfSZszYcYuAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyyOEoeAEDHTHssaedhth";
|
|---|
| 46 | +
|
|---|
| 47 | + $this->assertEquals( $output, remove_accents( $input ), 'remove_accents from ISO-8859-1 text' );
|
|---|
| 48 | + }
|
|---|
| 49 | +}
|
|---|
| 50 | +
|
|---|
| 51 | ?>
|
|---|
| 52 | Index: wp-testcase/jacob/TestFormatting.php
|
|---|
| 53 | ===================================================================
|
|---|
| 54 | --- wp-testcase/jacob/TestFormatting.php (revision 444)
|
|---|
| 55 | +++ wp-testcase/jacob/TestFormatting.php (working copy)
|
|---|
| 56 | @@ -81,57 +81,6 @@
|
|---|
| 57 | }
|
|---|
| 58 |
|
|---|
| 59 | /*
|
|---|
| 60 | -Removes accents from characters and decomposes ligatures.
|
|---|
| 61 | -*/
|
|---|
| 62 | -class Test_Remove_Accents extends _WPFormattingTest {
|
|---|
| 63 | -
|
|---|
| 64 | - /*
|
|---|
| 65 | - http://www.alanwood.net/unicode/latin_1_supplement.html
|
|---|
| 66 | -
|
|---|
| 67 | - unicode-latin-1-supplement is identical to iso-8859-1, so these
|
|---|
| 68 | - tests on their own will never take the unicode codepath
|
|---|
| 69 | - */
|
|---|
| 70 | - function test_removes_accents_from_decomposable_latin1_supplement() {
|
|---|
| 71 | - $this->file_test("removes_accents_from_decomposable_latin1_supplement",
|
|---|
| 72 | - "remove_accents");
|
|---|
| 73 | - }
|
|---|
| 74 | -
|
|---|
| 75 | - /*
|
|---|
| 76 | - Several characters, such as eth and thorn, do not have a unicode
|
|---|
| 77 | - decomposition, but should be replaced. The eth, for example, should become
|
|---|
| 78 | - "d" or "dh", and the thorn "th". They require special rules.
|
|---|
| 79 | - */
|
|---|
| 80 | - function test_removes_accents_from_undecomposable_latin1_supplement() {
|
|---|
| 81 | - $this->file_test("removes_accents_from_undecomposable_latin1_supplement",
|
|---|
| 82 | - "remove_accents");
|
|---|
| 83 | - }
|
|---|
| 84 | - function test_removes_accents_from_latin1_supplement() {
|
|---|
| 85 | - $this->file_test("removes_accents_from_latin1_supplement",
|
|---|
| 86 | - "remove_accents");
|
|---|
| 87 | - }
|
|---|
| 88 | -
|
|---|
| 89 | - function test_removes_accents_from_decomposable_latin_extended_a() {
|
|---|
| 90 | - $this->file_test("removes_accents_from_decomposable_latin_extended_a",
|
|---|
| 91 | - "remove_accents");
|
|---|
| 92 | - }
|
|---|
| 93 | - function test_removes_accents_from_undecomposable_latin_extended_a() {
|
|---|
| 94 | - $this->file_test("removes_accents_from_undecomposable_latin_extended_a",
|
|---|
| 95 | - "remove_accents");
|
|---|
| 96 | - }
|
|---|
| 97 | - function test_removes_accents_from_latin_extended_a() {
|
|---|
| 98 | - $this->file_test("removes_accents_from_latin_extended_a",
|
|---|
| 99 | - "remove_accents");
|
|---|
| 100 | - }
|
|---|
| 101 | -
|
|---|
| 102 | - // Currently this test fails because the unicode codepath (seems_utf8 == true)
|
|---|
| 103 | - // can't handle non-decomposable characters (eth and friends).
|
|---|
| 104 | - function test_removes_accents_from_latin1_supplement_and_latin_extended_a() {
|
|---|
| 105 | - $this->file_test("removes_accents_from_latin1_supplement_and_latin_extended_a",
|
|---|
| 106 | - "remove_accents");
|
|---|
| 107 | - }
|
|---|
| 108 | -}
|
|---|
| 109 | -
|
|---|
| 110 | -/*
|
|---|
| 111 | Decodes text in RFC2047 "Q"-encoding, e.g.
|
|---|
| 112 |
|
|---|
| 113 | =?iso-8859-1?q?this=20is=20some=20text?=
|
|---|
| 114 | Index: wp-testdata/formatting/remove_accents.01.input.txt
|
|---|
| 115 | ===================================================================
|
|---|
| 116 | --- wp-testdata/formatting/remove_accents.01.input.txt (revision 0)
|
|---|
| 117 | +++ wp-testdata/formatting/remove_accents.01.input.txt (revision 0)
|
|---|
| 118 | @@ -0,0 +1 @@
|
|---|
| 119 | +¢¥µÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿÆÐÞßæðþ
|
|---|
| 120 |
|
|---|
| 121 | Property changes on: wp-testdata/formatting/remove_accents.01.input.txt
|
|---|
| 122 | ___________________________________________________________________
|
|---|
| 123 | Added: svn:mime-type
|
|---|
| 124 | + text/plain; charset=ISO-8859-1
|
|---|
| 125 |
|
|---|
| 126 | Index: wp-testdata/jacob/removes_accents_from_decomposable_latin1_supplement.input.txt
|
|---|
| 127 | ===================================================================
|
|---|
| 128 | --- wp-testdata/jacob/removes_accents_from_decomposable_latin1_supplement.input.txt (revision 444)
|
|---|
| 129 | +++ wp-testdata/jacob/removes_accents_from_decomposable_latin1_supplement.input.txt (working copy)
|
|---|
| 130 | @@ -1 +0,0 @@
|
|---|
| 131 | -
|
|---|
| 132 | Index: wp-testdata/jacob/removes_accents_from_decomposable_latin1_supplement.output.txt
|
|---|
| 133 | ===================================================================
|
|---|
| 134 | --- wp-testdata/jacob/removes_accents_from_decomposable_latin1_supplement.output.txt (revision 444)
|
|---|
| 135 | +++ wp-testdata/jacob/removes_accents_from_decomposable_latin1_supplement.output.txt (working copy)
|
|---|
| 136 | @@ -1 +0,0 @@
|
|---|
| 137 | -AAAAAACEEEEIIIINOOOOOUUUUYaaaaaaceeeeiiiinooooouuuuyy
|
|---|
| 138 | Index: wp-testdata/jacob/removes_accents_from_undecomposable_latin1_supplement.input.txt
|
|---|
| 139 | ===================================================================
|
|---|
| 140 | --- wp-testdata/jacob/removes_accents_from_undecomposable_latin1_supplement.input.txt (revision 444)
|
|---|
| 141 | +++ wp-testdata/jacob/removes_accents_from_undecomposable_latin1_supplement.input.txt (working copy)
|
|---|
| 142 | @@ -1 +0,0 @@
|
|---|
| 143 | -
|
|---|
| 144 | Index: wp-testdata/jacob/removes_accents_from_undecomposable_latin1_supplement.output.txt
|
|---|
| 145 | ===================================================================
|
|---|
| 146 | --- wp-testdata/jacob/removes_accents_from_undecomposable_latin1_supplement.output.txt (revision 444)
|
|---|
| 147 | +++ wp-testdata/jacob/removes_accents_from_undecomposable_latin1_supplement.output.txt (working copy)
|
|---|
| 148 | @@ -1 +0,0 @@
|
|---|
| 149 | -AEDHOTHssaedhoth
|
|---|
| 150 | Index: wp-testdata/jacob/removes_accents_from_latin_extended_a.input.txt
|
|---|
| 151 | ===================================================================
|
|---|
| 152 | --- wp-testdata/jacob/removes_accents_from_latin_extended_a.input.txt (revision 444)
|
|---|
| 153 | +++ wp-testdata/jacob/removes_accents_from_latin_extended_a.input.txt (working copy)
|
|---|
| 154 | @@ -1 +0,0 @@
|
|---|
| 155 | -AaAaAaCcCcCcCcDdEeEeEeEeEeGgGgGgGgHhIiIiIiIiIJjKkLlLlLlNnNnNnOoOoOoRrRrRrSsSsSsTtTtUuUuUuUuUuUuWwYyZzZz??????
|
|---|
| 156 | Index: wp-testdata/jacob/removes_accents_from_latin_extended_a.output.txt
|
|---|
| 157 | ===================================================================
|
|---|
| 158 | --- wp-testdata/jacob/removes_accents_from_latin_extended_a.output.txt (revision 444)
|
|---|
| 159 | +++ wp-testdata/jacob/removes_accents_from_latin_extended_a.output.txt (working copy)
|
|---|
| 160 | @@ -1 +0,0 @@
|
|---|
| 161 | -AaAaAaCcCcCcCcDdEeEeEeEeEeGgGgGgGgHhIiIiIiIiIJjKkLlLlLlNnNnNnOoOoOoRrRrRrSsSsSsSsTtTtUuUuUuUuUuUuWwYyYZzZzZzIJijLlNs
|
|---|
| 162 | Index: wp-testdata/jacob/removes_accents_from_latin1_supplement_and_latin_extended_a.input.txt
|
|---|
| 163 | ===================================================================
|
|---|
| 164 | --- wp-testdata/jacob/removes_accents_from_latin1_supplement_and_latin_extended_a.input.txt (revision 444)
|
|---|
| 165 | +++ wp-testdata/jacob/removes_accents_from_latin1_supplement_and_latin_extended_a.input.txt (working copy)
|
|---|
| 166 | @@ -1 +0,0 @@
|
|---|
| 167 | -ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöùúûüýÿÆÐØÞßæðøþAaAaAaCcCcCcCcDdEeEeEeEeEeGgGgGgGgHhIiIiIiIiIJjKkLlLlLlNnNnNnOoOoOoRrRrRrSsSsSsTtTtUuUuUuUuUuUuWwYyZzZz??????
|
|---|
| 168 | Index: wp-testdata/jacob/removes_accents_from_latin1_supplement_and_latin_extended_a.output.txt
|
|---|
| 169 | ===================================================================
|
|---|
| 170 | --- wp-testdata/jacob/removes_accents_from_latin1_supplement_and_latin_extended_a.output.txt (revision 444)
|
|---|
| 171 | +++ wp-testdata/jacob/removes_accents_from_latin1_supplement_and_latin_extended_a.output.txt (working copy)
|
|---|
| 172 | @@ -1 +0,0 @@
|
|---|
| 173 | -AAAAAACEEEEIIIINOOOOOUUUUYaaaaaaceeeeiiiinooooouuuuyyAEDHOTHssaedhothAaAaAaCcCcCcCcDdEeEeEeEeEeGgGgGgGgHhIiIiIiIiIJjKkLlLlLlNnNnNnOoOoOoRrRrRrSsSsSsSsTtTtUuUuUuUuUuUuWwYyYZzZzZzIJijLlNs
|
|---|
| 174 | Index: wp-testdata/jacob/removes_accents_from_decomposable_latin_extended_a.input.txt
|
|---|
| 175 | ===================================================================
|
|---|
| 176 | --- wp-testdata/jacob/removes_accents_from_decomposable_latin_extended_a.input.txt (revision 444)
|
|---|
| 177 | +++ wp-testdata/jacob/removes_accents_from_decomposable_latin_extended_a.input.txt (working copy)
|
|---|
| 178 | @@ -1 +0,0 @@
|
|---|
| 179 | -AaAaAaCcCcCcCcDdEeEeEeEeEeGgGgGgGgHhIiIiIiIiIJjKkLlLlLlNnNnNnOoOoOoRrRrRrSsSsSsTtTtUuUuUuUuUuUuWwYyZzZz
|
|---|
| 180 | Index: wp-testdata/jacob/removes_accents_from_latin1_supplement.input.txt
|
|---|
| 181 | ===================================================================
|
|---|
| 182 | --- wp-testdata/jacob/removes_accents_from_latin1_supplement.input.txt (revision 444)
|
|---|
| 183 | +++ wp-testdata/jacob/removes_accents_from_latin1_supplement.input.txt (working copy)
|
|---|
| 184 | @@ -1 +0,0 @@
|
|---|
| 185 | -
|
|---|
| 186 | Index: wp-testdata/jacob/removes_accents_from_latin1_supplement.output.txt
|
|---|
| 187 | ===================================================================
|
|---|
| 188 | --- wp-testdata/jacob/removes_accents_from_latin1_supplement.output.txt (revision 444)
|
|---|
| 189 | +++ wp-testdata/jacob/removes_accents_from_latin1_supplement.output.txt (working copy)
|
|---|
| 190 | @@ -1 +0,0 @@
|
|---|
| 191 | -AAAAAACEEEEIIIINOOOOOUUUUYaaaaaaceeeeiiiinooooouuuuyyAEDHOTHssaedhoth
|
|---|
| 192 | Index: wp-testdata/jacob/removes_accents_from_decomposable_latin_extended_a.output.txt
|
|---|
| 193 | ===================================================================
|
|---|
| 194 | --- wp-testdata/jacob/removes_accents_from_decomposable_latin_extended_a.output.txt (revision 444)
|
|---|
| 195 | +++ wp-testdata/jacob/removes_accents_from_decomposable_latin_extended_a.output.txt (working copy)
|
|---|
| 196 | @@ -1 +0,0 @@
|
|---|
| 197 | -AaAaAaCcCcCcCcDdEeEeEeEeEeGgGgGgGgHhIiIiIiIiIJjKkLlLlLlNnNnNnOoOoOoRrRrRrSsSsSsSsTtTtUuUuUuUuUuUuWwYyYZzZzZz
|
|---|
| 198 | Index: wp-testdata/jacob/removes_accents_from_undecomposable_latin_extended_a.input.txt
|
|---|
| 199 | ===================================================================
|
|---|
| 200 | --- wp-testdata/jacob/removes_accents_from_undecomposable_latin_extended_a.input.txt (revision 444)
|
|---|
| 201 | +++ wp-testdata/jacob/removes_accents_from_undecomposable_latin_extended_a.input.txt (working copy)
|
|---|
| 202 | @@ -1 +0,0 @@
|
|---|
| 203 | -??????
|
|---|
| 204 | Index: wp-testdata/jacob/removes_accents_from_undecomposable_latin_extended_a.output.txt
|
|---|
| 205 | ===================================================================
|
|---|
| 206 | --- wp-testdata/jacob/removes_accents_from_undecomposable_latin_extended_a.output.txt (revision 444)
|
|---|
| 207 | +++ wp-testdata/jacob/removes_accents_from_undecomposable_latin_extended_a.output.txt (working copy)
|
|---|
| 208 | @@ -1 +0,0 @@
|
|---|
| 209 | -IJijLlNs
|
|---|