Took care of pesky Smart Quotes with utf8_encode()

For the longest time I’ve had our writers at work who always copy from Word docs with Smart Quotes have our RSS feed balk when it encountered the Smart Quotes. I took many stabs attempting to replace them with standard quotes to no avail. It was one of those problems where I never really devoted a great deal of time at solving as it didn’t occur often enough to take me completely away from whatever issue I was then working on.

I just realized that the PHP utf8_encode() function which encodes an ISO-8859-1 string to UTF-8 does just that. Just a simple little function that’s been around a very long time was there just and I had overlooked it.

Now I just apply that function before outputting the data and so far so good. Just figured I’d share if someone else was running into this same issue.

Leave a Reply

Your email address will not be published. Required fields are marked *