Onna.t

From TORI
Jump to navigation Jump to search

onna.t is PHP program that returns encoding of 3 similar characters:
(X2F25)
(X5973)
女 (XF981)

The last one has certain problem:
At the default setting of mediawiki, article with name 女 cannot be accesssed;
An attempt to access (XF981) redirects to (X5973). For this case, some programming is necessary. One example of the program is copy pasted below. For the execution, file uni.t also should be loaded.

Program

<?php
include "uni.t";

$a=unichr(0x2f25); // echo "$a\n";
$a.=unichr(0x5973); //echo "$a\n";
$a.=unichr(0xF981); echo "$a\n";
$N=strlen($a);
echo "The array has $N bytes; here is its splitting:\n";

for($n=0;$n<$N;$n++) {printf("%02x ",ord($a[$n]) );}
echo "\n";
$b = mb_str_split($a);
var_dump($b);

$M=count($b);
for($m=0;$m<$M;$m++)
{
printf("\n");
$c=$b[$m];
$u=uniord($c);
printf("Unicode character number %05d id est, [[X%04X]]\n",$u,$u);
$d=strlen($c);
echo "Picture: [[$c]]; uses $d bytes. These bytes are:\n";
for($n=0;$n<$d;$n++) printf("X%2X ",ord($c[$n]));
printf("in the hexadecimal representation and\n");
for($n=0;$n<$d;$n++) printf("%3d ",ord($c[$n]));
printf("in the decimal representation\n");
}
?>

How to use

for the execution, file uni.t is also rewired. Then, onna.t can be called with out parameters:

php onna.t

References


Keywords

Chinese, Japanese, PHP, Kanji, KanjiConfudal, KanjiLiberal, KanjiRadical, Onna, PHP, Unicode, Utf8