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