Hi Ian M. Evans,
On Fri, 17 Jan 2003 14:04:15 -0500, you wrote about "[PHP] Converting
accented characters or numeric equivalents to non-accented" something that
looked like this:
>Does anyone have a quick PHP function for converting accented characters to
>their non-accented forms? It would really help a lot with Amazon searches,
>etc.
Not sure about quick, but the only way I've found that works with 100%
guarantee everytime is to take the string and check it character by
character, and if the ascii value is > 128, simply replace it with the
ascii value marker...
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...
The above structure is what I use constantly to do this...
HTH
Rene
--
Rene Brehmer
This message was written on 100% recycled spam.
Come see! My brand new site is now online!
http://www.metalbunny.net
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php