Attempt at converting entities in plain text email

stoptime - March 16, 2009 - 16:55
Project:Notify
Version:6.x-1.0
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:postponed (maintainer needs more info)
Description

Hi there,

Seems html entities are not handled, so I'm investigating a way to convert these entities to their plain text (or utf8) equivalents before sending out an email. I was playing around with a function like this:

<?php
function handle_entities($text) {
 
$trans_tbl = get_html_translation_table(HTML_ENTITIES); 
 
$trans_tbl = array_flip($trans_tbl);
  return
strtr($text, $trans_tbl);
}
?>

But was wondering if maybe there was a better approach.

 
 

Drupal is a registered trademark of Dries Buytaert.