function superhtmlentities($text) {
$wordentities = array(
128 => 'euro',
130 => 'sbquo',
131 => 'fnof',
132 => 'bdquo',
133 => 'hellip',
134 => 'dagger',
135 => 'Dagger',
136 => 'circ',
137 => 'permil',
138 => 'Scaron',
139 => 'lsaquo',
140 => 'OElig',
145 => 'lsquo',
146 => 'rsquo',
147 => 'ldquo',
148 => 'rdquo',
149 => 'bull',
150 => '#45',
151 => 'mdash',
152 => 'tilde',
153 => 'trade',
154 => 'scaron',
155 => 'rsaquo',
156 => 'oelig',
159 => 'Yuml'
);
$new_text = '';
for($i = 0; $i < strlen($text); $i++) {
$wordentity = ord($text{$i});
if (array_key_exists($wordentity, $wordentities)) {
switch ($wordentity) {
case 150:
$new_text .= '-';
break;
default:
$new_text .= '&'.$wordentities[$wordentity].';';
}
} else {
if($wordentity < 127 ¦¦ $wordentity > 159) {
$new_text .= $text{$i};
}
}
}
return $new_text;
}