Reply to Re: DOM: accented characters

Your name:

Reply:


Posted by Janwillem Borleffs on 08/28/05 14:57

Jonathan Mcdougall wrote:
> Is there a php function which translates special characters to
> character codes?
> htmlentities() only translates to named codes (é).
>

You can use the translation table used by htmlentities() and
htmlspecialchars() as follows:

$table = get_html_translation_table(HTML_ENTITIES);
foreach (array_keys($table) as $k) {
$table[$k] = '&#' . ord($k) . ';';
}

And then apply it as the second argument to strtr():

$text = strtr($text, $table);


JW

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация