I am having a problem with some data in my database. I am storing Magic: The Gathering card names in a database along with all of the data associated with each card, and allowing the members of my website to build deck lists for the game.
Once the users enter the deck list in a form (in plain text) I search the database to verify that each card is a real card using a php function I wrote. If the card name given by the user is not found in the database, I do not allow the card to be stored in the deck list.
Problem is that some cards have special characters such as "Æ" that, although they do show up in the database (using utf8 collation), for some reason the search will fail to find the card. I am a little puzzled by this. I have even copied and pasted the data as it appears in the database directly into the form, and it still does not find the card. Very puzzling to me.
Can someone please tell me how to solve this? Is there something special I need to code in PHP? Or should I be using a different collation other than UTF8?
According to this UTF8 Unicode chart "Æ" is a UTF8 character.
As a band-aid solution (which won't actually fix anything) you could always use RegEx to replace special characters with a wildcard "%" in the search text, that way "Æther Charge" would be searched in the database as "%ther Charge", thus giving you "Æther Charge".
o . Q
_—__ "You live and you learn; or you don't live long." - Lazarus Long
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)