Matching words with accents, carrots, squigglies, etc

software development

#1

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.


#2

I’m not an expert but as I search you need to state that your script is UTF8, I found 2 links with information, I hope that helps:

http://bugs.php.net/bug.php?id=30800 A bug report on php.net

http://www.phpwact.org/php/i18n/utf-8 UTF8 usage on php (wiki)


Dark and difficult times lie ahead… Now is the time that we must choose between what is right, and what is easy. A.D