I am having trouble with apostrophes causing errors in a grading system I have setup. When a customer submits a paper that contains apostrophes, I am replacing all apostrophes with PHP like so:
//Now remove Apostrophes
$essay = str_replace("'","", $essay) ;
The problem is though this does not work for all types of different apostrophes. An example:
This apostrophe ’ is different than this apostrophe '. I am guessing the solution is to update the $essay
variable to a standard apostrophe type and then use str_replace
to remove all apostrophes.
Any help in this matter would be greatly appreciated!
While I don't agree with your perilous vendetta against proper typography, I can tell you that you will need a str_replace()
for each of the different kinds of apostrophe-esque characters that there are. Just do a bunch of str_replace()
s with each kind of apostrophes you want removed.
I still think you are trying to solve a problem by avoiding it rather than solving it. Apostrophes are perfectly ok to put into a mysql database, it might just need to have a different character set or collation.