note 26379 modified in function.htmlentities by danbrown

From: Date: Sun, 17 May 2009 17:12:49 +0000
Subject: note 26379 modified in function.htmlentities by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-154956@lists.php.net to get a copy of this message
without heavy scientific analysis, this seems to work as a quick fix to making text originating from a Microsoft Word document display as HTML: <?php function DoHTMLEntities ($string) { $trans_tbl = get_html_translation_table (HTML_ENTITIES); // MS Word strangeness.. // smart single/ double quotes: $trans_tbl[chr(145)] = '\''; $trans_tbl[chr(146)] = '\''; $trans_tbl[chr(147)] = '&quot;'; $trans_tbl[chr(148)] = '&quot;'; // Acute 'e' $trans_tbl[chr(142)] = '&eacute;'; return strtr ($string, $trans_tbl); } ?> --was-- without heavy scientific analysis, this seems to work as a quick fix to making text originating from a Microsoft Word document display as HTML: function DoHTMLEntities ($string) { $trans_tbl = get_html_translation_table (HTML_ENTITIES); // MS Word strangeness.. // smart single/ double quotes: $trans_tbl[chr(145)] = '\''; $trans_tbl[chr(146)] = '\''; $trans_tbl[chr(147)] = '&quot;'; $trans_tbl[chr(148)] = '&quot;'; // é : $trans_tbl[chr(142)] = '&eacute;'; return strtr ($string, $trans_tbl); } http://php.net/manual/en/function.htmlentities.php

« previous php.notes (#154956) next »