2002-03-02 10:44:57 +00:00
|
|
|
|
<?php
|
|
|
|
|
// TODO: Add more encoding
|
|
|
|
|
//$debug = true;
|
|
|
|
|
ini_set('include_path','.');
|
2002-03-18 06:03:53 +00:00
|
|
|
|
include_once('common.inc');
|
2002-03-02 10:44:57 +00:00
|
|
|
|
|
|
|
|
|
// EUC-JP
|
|
|
|
|
$euc_jp = '0123<32><33><EFBFBD><EFBFBD>ʸ<EFBFBD><CAB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܸ<EFBFBD><DCB8>Ǥ<EFBFBD><C7A4><EFBFBD>EUC-JP<4A><50><EFBFBD>ȤäƤ<C3A4><C6A4>ޤ<EFBFBD><DEA4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܸ<EFBFBD><DCB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݽ<EFBFBD><DDBD><EFBFBD><EFBFBD><EFBFBD>';
|
|
|
|
|
|
|
|
|
|
print "1: ". mb_strimwidth($euc_jp, 0, 15,'...','EUC-JP') . "\n";
|
|
|
|
|
print "2: ". mb_strimwidth($euc_jp, 0, 100,'...','EUC-JP') . "\n";
|
|
|
|
|
print "3: ". mb_strimwidth($euc_jp, 15, 100,'...','EUC-JP') . "\n";
|
|
|
|
|
// Note: Did not start form -22 offset. Staring from 0.
|
2002-03-16 07:33:21 +00:00
|
|
|
|
$str = mb_strimwidth($euc_jp,-22, 100,'...','EUC-JP');
|
|
|
|
|
($str === FALSE) ? print "4 OK\n" : print "NG: $str\n";
|
2002-03-02 10:44:57 +00:00
|
|
|
|
|
|
|
|
|
$str = mb_strimwidth($euc_jp, 100, -10,'...','EUC-JP');
|
2002-03-16 07:33:21 +00:00
|
|
|
|
($str === FALSE) ? print "5 OK\n" : print "NG: $str\n";
|
2002-03-02 10:44:57 +00:00
|
|
|
|
|
|
|
|
|
$str = mb_strimwidth($euc_jp, -100, 10,'...','EUC-JP');
|
2002-03-16 07:33:21 +00:00
|
|
|
|
($str === FALSE) ? print "6 OK\n" : print "NG: $str\n";
|
2002-03-02 10:44:57 +00:00
|
|
|
|
|
|
|
|
|
?>
|