Jump to content

PHP Function: 'Ç' -=> 'Ç'


itazev

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/51135-php-function-%C3%A7-%C3%A7/
Share on other sites

If you wanr to be more selective than htmlentities, you could use strtr()

 

<?php
$ansi = array(
    'É'	=> 'É' ,
    'Ê'	=> 'Ê' ,
    'Í'	=> 'Í' ,
    'Ó'	=> 'Ó' ,
    'Ô'	=> 'Ô'
);

$txt = 'RECIPÉ RÓLE';

echo strtr($txt, $ansi)
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.