itazev Posted May 13, 2007 Share Posted May 13, 2007 Hey everyone! I'm trying to figure out how to build a function to REPLACE non-standard chars in a HTML string such as É É Ê Ê Í Í Ó Ó Ô Ô something like function AnsiChars($htm_string){ ... return <<html with special char codes replaced>> } http://www.php.net/chr The problem is how do I get the char number to replace it try pressing ALT+0199 in your keyboard and you get what i mean. I appreciate any help! Quote Link to comment https://forums.phpfreaks.com/topic/51135-php-function-%C3%A7-%C3%A7/ Share on other sites More sharing options...
genericnumber1 Posted May 13, 2007 Share Posted May 13, 2007 perhaps http://us.php.net/htmlentities would work? -- I've never tested it with foreign characters though Quote Link to comment https://forums.phpfreaks.com/topic/51135-php-function-%C3%A7-%C3%A7/#findComment-251733 Share on other sites More sharing options...
itazev Posted May 13, 2007 Author Share Posted May 13, 2007 hmmm interesting functions! I never heard of! Seems to solve my broblem! I'll test them! Thank you genericnumber1 Quote Link to comment https://forums.phpfreaks.com/topic/51135-php-function-%C3%A7-%C3%A7/#findComment-251739 Share on other sites More sharing options...
Barand Posted May 13, 2007 Share Posted May 13, 2007 If you wanr to be more selective than htmlentities, you could use strtr() <?php $ansi = array( 'É' => 'É' , 'Ê' => 'Ê' , 'Í' => 'Í' , 'Ó' => 'Ó' , 'Ô' => 'Ô' ); $txt = 'RECIPÉ RÓLE'; echo strtr($txt, $ansi) ?> Quote Link to comment https://forums.phpfreaks.com/topic/51135-php-function-%C3%A7-%C3%A7/#findComment-251862 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.