matching words with accents, carrots, squigglies, etc.
Posted by: dambro
Posted on: 2009-07-12 10:42:00
It seems that mysql and php have different thresholds for matching a character with an accent.
Take the spanish name, "Peņa."
A query on my database like this: "SELECT * FROM `names` WHERE last = 'Pena'" still turns up Peņa, even though the two aren't exactly the same. (Thank goodness.)
Unfortunately, I can't do the same in PHP.
For example:
$name = 'Peņa';
$name2 = 'Pena';
Try testing $name == $name2 in php, and it will fail.
So my question is this:
Does anyone know of a php script that would replace characters with accents (and other types of carrots and squigglies) with their standard (boring) English counterparts?
Thanks.