Ud.t
Jump to navigation
Jump to search
// ud.t inputs the hexadecimal numbers and interpret them as the Unicode characters.
<?php include "uni.t"; $K=$argc; printf("K=%2d \n",$K); for($k=1; $k<$K; $k++) { $a=$argv[$k]; $b=hexdec($a); $c=unichr($b); $u=uniord($c); printf("\n%s %5d [[&#X%04X;]] %s\n",$a,$b,$b, $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"); } //k ?>
Dependence
For the execution, file uni.t also should be loaded. Then, the call may have form
php yd.t hnu1 hnu2 ..
where "hnu?" are hexadecimal numbers (no need to type leading "0X"). Examples:
php ud.t 2F25 2F26 5B50
returns encoding of characters ⼥, X2F25 and ⼦, X2F26 and 子, X5B50;
php ud.t 4E86 F9BA
returns encoding of characters 了, X4E86 and 了, XF9BA (that cannot be typed nor copypasted directly in the most of software);
php ud.t 30A1 30A2 4E86 F9BA
returns encoding of characters ァ X30A1 and ア X30A2 and 了, X4E86 and 了, XF9BA (that cannot be typed nor copypasted directly in the most of software);