Mi piacerebbe sapere come caspio è che non ti funziona, ma che test fai?
Usa htmlentities() che forse è la cosa più appropriata.