Re: Converting accented characters or numeric equivalents to non-accented

From: Date: Sat, 18 Jan 2003 17:38:01 +0000
Subject: Re: Converting accented characters or numeric equivalents to non-accented
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-132108@lists.php.net to get a copy of this message
-<[ Rene Brehmer ]>- wrote:
something like this (untested): for ($i = 0; $i < strlen($string_to_parse); $i++) { $char = substr($string_to_parse, $i, 1); if (ord($char) > 128) { $output_string .= "&#".ord($char).";"; } else { $output_string .= $char; } } You may need to test for value 127 ... not sure if it starts on 0 or 1 that is... 127 is the last of the 7bit numbers (01111111), 128 has the 8th bit on (10000000), so perhaps you want to test for > 127 rather than > 128.
Regards Chris

« previous php.general (#132108) next »