Hello all,

I have a feeling this is easy to deal with (at least I hope so) but couldn't find much on google, probably because I'm not 100% sure how to word it. Here goes...

We all know how there's different representations for apostrophes. There's the ’ character and then there's '. This is affecting the search application on my website. If someone searches for John's Music, but it just so happens John's Music is entered into the database using the alternate apostrophe (John’s Music), no results will show. How can I correct this issue?

Thanks

Recommended Answers

All 3 Replies

The best way to deal with this is to make sure you store only one kind of apostrophe in your database no matter what the user enters. So before storing the value in the database do a str_replace() to strore appropriate apostrophe.
Also in the search module, take the user input and do a str_replace() to change the possible apostrophe to the desired one. Then use this in your query.

I hope this helps.

The best way to deal with this is to make sure you store only one kind of apostrophe in your database no matter what the user enters. So before storing the value in the database do a str_replace() to strore appropriate apostrophe.
Also in the search module, take the user input and do a str_replace() to change the possible apostrophe to the desired one. Then use this in your query.

I hope this helps.

It does help, thank you for your input. This was where I was going to go with it but was hoping there maybe have been something a little more direct.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.