Go to the documentation of this file.
25 if( PHP_SAPI !=
'cli' ) {
26 die(
"Run me from the command line please.\n" );
30 $file =
"NormalizationTest.txt";
33 define (
'COMMENT',
'#' );
36 define (
'SEPARATOR',
';' );
68 require_once
'./UtfNormal.php';
86 assert_options(ASSERT_ACTIVE, 1);
87 assert_options(ASSERT_WARNING, 0);
88 assert_options(ASSERT_QUIET_EVAL, 1);
89 assert_options(ASSERT_CALLBACK,
'my_assert');
93 echo
"Assertion that '$code' failed on line $lineNo ($col[5])\n";
99 while( ( $col =
getRow(
$f ) ) !==
false ) {
102 if(count($col) == 6) {
104 if(
$count % 100 === 0 ) echo
"Count: $count\n";
109 # verify that the pure PHP version is correct
112 assert(
'$NFCc1 === $NFCc1p');
115 assert(
'$NFCc2 === $NFCc2p');
118 assert(
'$NFCc3 === $NFCc3p');
121 assert(
'$NFCc4 === $NFCc4p');
124 assert(
'$NFCc5 === $NFCc5p');
128 assert(
'$NFDc1 === $NFDc1p');
131 assert(
'$NFDc2 === $NFDc2p');
134 assert(
'$NFDc3 === $NFDc3p');
137 assert(
'$NFDc4 === $NFDc4p');
140 assert(
'$NFDc5 === $NFDc5p');
144 assert(
'$NFKDc1 === $NFKDc1p');
147 assert(
'$NFKDc2 === $NFKDc2p');
150 assert(
'$NFKDc3 === $NFKDc3p');
153 assert(
'$NFKDc4 === $NFKDc4p');
156 assert(
'$NFKDc5 === $NFKDc5p');
160 assert(
'$NFKCc1 === $NFKCc1p');
163 assert(
'$NFKCc2 === $NFKCc2p');
166 assert(
'$NFKCc3 === $NFKCc3p');
169 assert(
'$NFKCc4 === $NFKCc4p');
172 assert(
'$NFKCc5 === $NFKCc5p');
174 # c2 == NFC(c1) == NFC(c2) == NFC(c3)
175 assert(
'$col[1] === $NFCc1');
176 assert(
'$col[1] === $NFCc2');
177 assert(
'$col[1] === $NFCc3');
179 # c4 == NFC(c4) == NFC(c5)
180 assert(
'$col[3] === $NFCc4');
181 assert(
'$col[3] === $NFCc5');
183 # c3 == NFD(c1) == NFD(c2) == NFD(c3)
184 assert(
'$col[2] === $NFDc1');
185 assert(
'$col[2] === $NFDc2');
186 assert(
'$col[2] === $NFDc3');
188 # c5 == NFD(c4) == NFD(c5)
189 assert(
'$col[4] === $NFDc4');
190 assert(
'$col[4] === $NFDc5');
192 # c4 == NFKC(c1) == NFKC(c2) == NFKC(c3) == NFKC(c4) == NFKC(c5)
193 assert(
'$col[3] === $NFKCc1');
194 assert(
'$col[3] === $NFKCc2');
195 assert(
'$col[3] === $NFKCc3');
196 assert(
'$col[3] === $NFKCc4');
197 assert(
'$col[3] === $NFKCc5');
199 # c5 == NFKD(c1) == NFKD(c2) == NFKD(c3) == NFKD(c4) == NFKD(c5)
200 assert(
'$col[4] === $NFKDc1');
201 assert(
'$col[4] === $NFKDc2');
202 assert(
'$col[4] === $NFKDc3');
203 assert(
'$col[4] === $NFKDc4');
204 assert(
'$col[4] === $NFKDc5');
213 } elseif ($c <= 0x7FF) {
214 return chr(0xC0 | $c >> 6) . chr(0x80 | $c & 0x3F);
215 } elseif ($c <= 0xFFFF) {
216 return chr(0xE0 | $c >> 12) . chr(0x80 | $c >> 6 & 0x3F)
217 . chr(0x80 | $c & 0x3F);
218 } elseif ($c <= 0x10FFFF) {
219 return chr(0xF0 | $c >> 18) . chr(0x80 | $c >> 12 & 0x3F)
220 . chr(0x80 | $c >> 6 & 0x3F)
221 . chr(0x80 | $c & 0x3F);
228 return implode(
"", array_map(
"unichr", array_map(
"hexdec", explode(
" ", $c))));
233 if( $row ===
false )
return false;
235 $pos = strpos( $row,
COMMENT );
236 $pos2 = strpos( $row,
")" );
237 if( $pos === 0 )
return array($row);
241 if($pos2) $c = substr( $row, $pos2 + 2 );
242 else $c = substr( $row, $pos );
243 $row = substr( $row, 0, $pos );
248 if( trim( $ent ) !==
"" ) {
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret
normalize_form_c($c)
The following section will be used for testing different normalization methods.
static toNFD( $string)
Convert a UTF-8 string to normal form D, canonical decomposition.
static toNFC( $string)
Convert a UTF-8 string to normal form C, canonical composition.
normalize_form_kd_php($c)
normalize_form_c_php($c)
This set of functions is only useful if youve added a param to the following functions to force pure ...
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
static toNFKD( $string)
Convert a UTF-8 string to normal form KD, compatibility decomposition.
normalize_form_kc_php($c)
if(PHP_SAPI !='cli') $file
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
static toNFKC( $string)
Convert a UTF-8 string to normal form KC, compatibility composition.
my_assert( $file, $line, $code)