Scusate, mi sono espresso male. Certo che lo fa, su certi charset. Intendevo dire che se vuole una soluzione che funzioni con tutti i charset (es. non solo l'ASCII compatibile con gli 8-bit Unicode, ad esempio per supportare lingue asiatiche), dovrebbe utilizzare altre funzioni.
Se gli bastano i charset supportati da htmlentities, può provare un codice tipo:
Codice PHP:
<?php
$content = 'Ciao a "tutti voi", il mio nome è [b]Lorenzo[/b]';
$fake_content = '>' . $content . '<';
$fake_content = preg_replace('#>([^<]*)<#e', "'>' . htmlentities(stripslashes('\\\\1')) . '<'", $fake_content);
$content = substr($fake_content, 1, -1);
print($content);
?>