function entities_rtrim($string,$length) {
if($length>=strlen($string))
{
return $string;
}
$s="";
for($i=0;$i<$length;$i )
{
if(ord($string{$i})>127)
{
$s.=$string{$i}.$string{ $i};
continue;
}else{
$s.=$string{$i};
continue;
}
}
return $s;
}